If a custom complex type is added to the WCF Ria service object class, for example, the children attribute below is a list of the entity itself:
If a domainservice returns the studentresult:
On the Silverlight client, you will find that the children attribute of the entity studentresult is invisible.
Cause and Solution
CauseThe WCF Ria service is an encapsulation of wcfservice. It uses datacontract to mark and serialize the required entities and has an automatic client.CodeGeneration Mechanism. Not every attribute is automatically generated during codegeneration unless necessary. The solution is to manually specify codegeneration, such as [include], [associate], and other server-side tags to mark the attribute you need, mark the link between this attribute and other entities (foreign key Association for example ).
In this way, the Silverlight client automatically obtains the complex object of the object. [Include] and [associate] are used to mark the codegeneration required for specifying the attribute.
Inheritance
InheritanceIn this case, there is no problem. Look at a complicated inheritance code:
Inherit and return the base class
In the above inheritance example, the inheritance class is returned in domainservice. If the base class (abstract class or interface) is returned to the client, the WCF serialization is more complex. You need to mark it with a known type (known type) of WCF. For details, refer to msdn Baiyou blog. For the inherited data model of the WCF Ria service, please refer to the msdn article for details.ArticleInheritance in data models.
For other articles, refer
In addition, you can refer to the article "Developing Silverlight using Entity Framework and WCF Ria services 5: querying the client's primary and foreign key tables" about the issue of the WCF Ria service.