Search code examples
wcf-ria-servicesdatacontract

How do I change the name of a poco on the client with RIA Services?


WCF allows you to specify a different name on the client than on the server:

[DataContract(Name = "MyClass")]
public class MyClassDC
{

}

How does one do this with RIA services? Can I still use data contracts?

Edits:

I tried decorating my class with DataContractAttribute and setting the Name field. It works well enough except that the name of the class on the client side is still the analog of MyClassDC instead of MyClass. Does the Name field not work with RIA Services?

BTW, I am trying very hard to get out a version of my application using WCF. I've had nothing but trouble working with RIA Services and I find it very limiting. I know it saves time, but it has been nothing but headaches for me. I love WCF. But for the time being I need to release a version that uses RIA Services.


Solution

  • I don't think that's possible as of today.

    You can change Name and/or Description of a property so if you set one as Required the client would see Client Name is required instead of ClientName (the real name of the property.

    This will not (of course) change anything on the generated property you'll see from the client.