Custom Complex type attributes of the WCF Ria service object class are invisible on the client

Source: Internet
Author: User

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.


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.