WCF RIA Services for POCO as Request Parameter

I define the method below in the DomainService class, but I get a compiler error: The "objectType" parameter of the GetPropertiesByGuiObject domain operation record must be one of the predefined serializable types .

public IQueryable<PropertyType> GetPropertiesByGuiObject(ObjectType objectType) { return properTypeDA0.GetPropertiesByGuiObject(objectType).AsQueryable(); } 

ObjectType is the POCO class defined by me. I added the [Serializable] or [DataContract] attribute to the definition of the ObjectType class, but the error still exists. Can a domain operation operation parameter be a POCO object?

+4
source share
2 answers

Are you using VS 2010 SP1? In the first version of WCF RIA Services (with RTM RT 2010), it did not have support for complex types, but in version SP1 this support was added. You can find more information at http://msdn.microsoft.com/en-us/library/gg602753 and http://blogs.msdn.com/b/digital_ruminations/archive/2010/10/28/complextypes-in -ria-services.aspx .

+3
source

Unfortunately, WCF RIA services (at least the current version) do not allow passing any complex type or POCO as parameters for you. "Predefined" here means a small set of types such as string, guid, etc.

I usually pass in an id or some link to get around this.

Hope this answers your question.

thanks

0
source

All Articles