Desirable download in EF1.0

I have a many-to-many relationship:

Application -> Applications_Servers -> Server

This is set up in my entity data model and all is well. My problem is that I would like to load the entire application graph so that I have IEnumerable<Applications>

, each application member populated with a collection Servers

associated with a many-to-many relationship.

Usually this won't be a problem, but according to my research there should be a navigation property between the Application and the Server. This is not the case for me, because my Applications_Servers

join table has more than just two keys. Hence, there is no navigation property between Application and Server and this does not work:

    var apps = (from a in context.Application.Include("Server")
               select a).ToList();

      

I am getting a message that the app called "Server" does not have a navigation property and, rightly so, it does not.

How do I write a request to download My applications from in this case?

+2


a source to share


1 answer


Just use the existing navigation properties.

context
   .Application
   .Include("Applications_Servers")
   .Include("Applications_Servers.Server")

      



In this case, you need to load all related objects Applications_Servers

and Server

.

+3


a source







All Articles