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 6031171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:08:38+00:00 2026-05-23T05:08:38+00:00

We recently upgraded a Silverlight 4 app that was using RIA Services and EF

  • 0

We recently upgraded a Silverlight 4 app that was using RIA Services and EF 4.0 with EDMXs to RIA Services SP1 and EF 4.1 using POCOs. The upgrade was well worth while, but it appears that RIA is now playing differently with how it exposes Associated Entities on the Client.

For example say we have the following EF POCOs which are also our RIA Entities:

public class Building
{
   public Building()
   {
     Rooms = new List<Room>();
   }

   [Key]
   public int? BuildingID { get; set; }

   public string Name {get; set;}

   [Association("Building_1-*_Rooms", "BuildingID", "BuildingID")]
   [Include]
   [Composition]
   public ICollection<Room> Rooms {get; set;}
}


public class Room
{
   [Key]
   public int? RoomID { get; set; }

   [Required]
   public int? BuildingID { get; set; }

   public string Name {get; set;}

   [Association("Building_1-*_Rooms", "BuildingID", "BuildingID", IsForeignKey= true)]
   [Include]
   public Building Building {get; set;}

   [Association("Room_1-*_Desks", "RoomID", "RoomID")]
   [Include]
   [Composition]
   public ICollection<Desk> Desks { get; set; }
}

public class Desk
{
   [Key]
   public int? DeskID { get; set; }

   [Required]
   public int? RoomID { get; set; }

   public string Name { get; set; }

   [Association("Room_1-*_Desks", "RoomID", "RoomID", IsForeignKey = true)]
   [Include]
   public Room Room { get; set; }
 }

Building is the parent of Room and Room is the parent of Desk. The Association attribute defines these relationships for RIA. We then expose these Entities with a simple service that has CRUD for all three entities

public class BuildingDomainService
{

 var _context= new BuildingEFContext(); //Lets just say this is our EF Context that has all three types on it

 public IQueryable<Buildings> GetBuildings()
 {
      return _context.Buildings.Include(x => x.Rooms.Select(y => y.Desks));
 }

 public IQueryable<Rooms> GetRooms()
 {
      return _context.Rooms.Include(x => x.Desks);
 }

 public IQueryable<Desk> GetDesks()
 {
      return _context.Desks;
 }

 //Empty Update and Insert Methods to allow editing on client
 public void UpdateBuilding(Building building){}
 public void InsertBuilding(Building building){}
 public void DeleteBuilding(Building building){}

 public void UpdateRoom(Room room){}
 public void InsertRoom(Room room){}
 public void DeleteRoom(Room room){}

 public void UpdateDesk(Desk desk){}
 public void InsertDesk (Desk desk){}
 public void DeleteDesk (Desk desk){}

}

On the client the BuildingDomainContext that is generated from the BuildingDomainService has the three Exposed Methods (GetBuildingsQuery(), GetRoomsQuery(), and GetDesksQuery()), but only a single EntitySet of type Building, the service does not expose an EntitySet for Room or Desk.

In some places in our client app we want to maintain this object Hierarchy, but in others we may only want to get a slice of it, For example if we want to get look at and edit Desks in a Room, but don’t care about Rooms in a Building. Because RIA Services does not expose an EntitySet for Room or Desk we cannot edit either of these without also pulling the parent Building.

Is there anyway to maintain these associations in RIA, but also allow for editing a part of this hierarchy, without having to pull in the top-most parent?

  • 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-23T05:08:39+00:00Added an answer on May 23, 2026 at 5:08 am

    I’d recommend reading this post on composition. When you add [Composition] attributes, it affects how the data flows from server to client as well as which entities you can edit independently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently upgraded my Silverlight app from 3 to 4. After a few hours
I recently upgraded to Eclipse Ganymede from Europa and now I'm finding that when
I recently upgraded a Web Application Project (as well as some dependent projects) from
I recently upgraded one of my applications to Rails 2.2.2. Having done that, I've
I recently upgraded to SilverLight 3 (beta) and for some reason the SilverLight plug
I recently upgraded to Xcode4 and noticed that my build/Release-iphoneos folder no longer gets
I recently upgraded from 4.0.1 to 4.2.1 and noticed that when I publish to
I recently upgraded to Xcode 4 (which is a great upgrade) but now I'm
I recently upgraded a VS2005 web deployment project to VS2008 - and now I
I recently upgraded to Subversion 1.5, and now I cannot commit my code to

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.