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

  • SEARCH
  • Home
  • 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 9084063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:55:01+00:00 2026-06-16T20:55:01+00:00

I am using a Silverlight 5 Business Application using RIA services to return a

  • 0

I am using a Silverlight 5 Business Application using RIA services to return a POCO class from the service side to populate a hierarchical menu.

The original problem I had with the POCO class was that the SubMenuItems property was not getting passed over RIA services although it was populated on the service side.

Original POCO

public class BusinessModelMenuDto
{
    [Key]
    [Required]
    public int ID { get; set; }
    public string TextToDisplay { get; set; }
    public string ImageSource { get; set; }
    public IEnumerable<BusinessModelMenuDto> SubMenuItems { get; set; }
}

Service call

 public IEnumerable<BusinessModelMenuDto> GetCabsHeirarchy()

Following some further investigation I found that the [Include] and [Association] attributes were required on the SubMenuItems to pass the data over. Doing this the first time with the Association of ID => ID did not give the desired results so I added the ParentID property and changed my loading code to populate the Foreign Key as below. I also changed the Associate to map from ID to Parent ID.

Updated POCO class

public class BusinessModelMenuDto
{
    [Key]
    [Required]
    public int ID { get; set; }
    public int? ParentID { get; set; }
    public string TextToDisplay { get; set; }
    public string ImageSource { get; set; }
    [Include]
    [Association("SubItems", "ID", "ParentID")]
    public IEnumerable<BusinessModelMenuDto> SubMenuItems { get; set; }
}

On the server side I am loading two levels of the menu at the moment so the top level item contains a collection of SubItems but there are no further SubItems below that.

The problem I have is that when RIA services sends the collection over the wire the hierarchy is being jumbled. I have confirmed that what I am returned is correctly structured but it does not arrive on the client side correctly. The top level is OK but the second level (SubMenuItems) is mixed up and two furter SubMenuItems levels have appeared.

Any idea what I am doing wrong? I assume that the problem is with the Association or the fact that the same POCO object (BusinessModelMenuDto) is being used for the multiple levels.

  • 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-06-16T20:55:03+00:00Added an answer on June 16, 2026 at 8:55 pm

    We found we had to use Guids for the item Key and assign a unique value to it on the server before passing back to the client.

    So your class definition would become:

    public class BusinessModelMenuDto
    {
        [Key]
        [Required]
        public Guid ID { get; set; }
        public Guid? ParentID { get; set; }
        public string TextToDisplay { get; set; }
        public string ImageSource { get; set; }
        [Include]
        [Association("SubItems", "ID", "ParentID")]
        public IEnumerable<BusinessModelMenuDto> SubMenuItems { get; set; }
    }
    

    Then when you create a new element set the ID:

    ID = Guid.NewGuid();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Silverlight Business Application, using a RIA service, which is returning POCO
I am creating a new Silverlight 4 business application using RIA services. This will
Background Currently I have a C# Silverlight business application which uses RIA Services. The
Background Currently I have a C# Silverlight business application which uses RIA Services. The
I have a silverlight business application created with vs2010 and it is RIA service
I have been experimenting recently with Silverlight, RIA Services, and Entity Framework using .NET
We are developing an Silverlight with Wcf business application. We are using Wcf DataContract
I downloaded an example of the application based on the .NET RIA services from
I am using Silverlight 4 business application and windows authentication, works fine i get
I'm trying to build a line of business application using Silverlight. I felt like

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.