views:

45

answers:

1

What are the current options for querying and joining two different Entity Data Models? I've seen that it's possible to share a single model schema between multiple mapping and storage schemas, but it seems clunky and not encouraged. The other option I can think of is to query the entities separately and then join the linq objects, but I'm not sure how I feel about dumping all of that into memory. Does anyone have any better solutions?

A: 

The two options you list are the only ones I'm aware of. The former is harder than using a single model, but I wouldn't say "not encouraged." It falls into the unfortunately broad category of "supported Entity Framework features with no support in the GUI designer." The latter option is actually not so bad if you can retrieve only what you need, but will result in retrieving entities from two separate ObjectContexts, which could be awkward if you update. That said, updating objects in multiple contexts, potentially from different databases, is strictly no matter how you do it.

The Entity Framework team had mentioned working on better solutions for the future, but this is a weak point today, and I don't think it's going to change much in v4.

Craig Stuntz
Right now it's only for retrieving data, and small amounts at that so I think I'll go with querying them separately. Just wanted to check and see if I was missing anything. Thanks for the response and the link.
Graham