Search code examples
silverlightwcfwcf-ria-services

WCF RIA Services for POCO as a query parameter


I define a method below in a DomainService class but get a compiler error: Parameter 'objectType' of domain operation entry 'GetPropertiesByGuiObject' must be one of the predefined serializable types.

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

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


Solution

  • Are you using VS 2010 SP1? On the first version of WCF RIA Services (with VS 2010 RTM), it did not have support for complex types, but in the SP1 version, 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.