Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6782187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:42:41+00:00 2026-05-26T16:42:41+00:00

Can I add a serializable property to an Entity or ComplexType using RIA Services?

  • 0

Can I add a serializable property to an Entity or ComplexType using RIA Services? Or can I create a DTO that contains an EntityObject using RIA? If it’s not possible, what’s the workaround?

I’ve seen How Can I Extend A Entity When Using RIA Services With Silverlight? which deals with adding a property to a Entity, but it’s a data-less property that merely wraps existing properties. In other words it’s not holding any new data. I apologise for the length of this question.

I have two results (one EntityObject from a table query, and one ComplexObject from a stored proc) in my data layer that I want to return together & in a single service call. They are inextricably linked from a presentation point of view (one doesn’t make sense without the other) and it would be unseemly to do two calls and then join them up client side. But I’m having problems getting the two objects in a single result.


First I tried to extend the ComplexObject by adding a property for the Entity

public partial class MyProcResult
{        
    [DataMember]
    public MyEntity Foo { get; set; }
}

and populating it in the domain service operation. The property is set on server side but it doesn’t get serialized – in fact the client doesn’t even see the property!

After some reading it’s apparent that I can make the client aware of properties by naming my partial class MyProcResult.shared.cs – and now the client knows the property exists, but it’s still not serialized.

So I assume that the RIA service isn’t exposing a very thorough service contract and try something else. My next attempt is to create a DTO in which I’ll include my two objects – should work, right?

[DataContract]
public class MyContainer
{
    [DataMember]
    public MyProcResult Bar { get; set; }
    [DataMember]
    public MyEntity Foo { get; set; }
}

Again, it’s all populated before serialization. This time the client can’t see the MyEntity property. It thinks that MyContainer only has the MyProcResult property. The generated code on the client side does not contain the other property!

What’s going on? What is special about these Entities that stops them from being serialized when marked [DataMember], or when included in a DTO?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:42:42+00:00Added an answer on May 26, 2026 at 4:42 pm

    For complex eneities, you have to give relationship for them(foreign key for instance), otherwise it’s not possible to expose composite eneity to client. For example:

    this sample wraps category entity collection in previous Product entity:

    public partial class ProductWrapper 
    {
         [Key]     
         public Guid Id { get; set; }     
         public string Name { get; set; }
    
         [Include]
         [Association("FK_ProductsWrapper", "Id", "CategoryId")]     
         public Category[] CategoryList { get; set; } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that I can add a HintPath to an external DLLs to help
Can I serialize POCO classes? I'm using the C# POCO entity generator. I tried
Can not deserialize following object graph. That Exception occurs when deserialize method called on
I'm creating a website using Entity Framework (4.1), which exposes WCF services, and I
Ruby can add methods to the Number class and other core types to get
I can add and remove the last line in my dynamic form and calculate
I know I can add a icon to the Resources.resx file of a project
I know one can add event listener for window.error. However when working with Iframes,
Users on my site can add nodes of a custom type (let's call it
How i can add the multiple values from a datagrid to textbox in C#?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.