Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EF Joins across one or more Models
Message
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01595692
Message ID:
01595781
Views:
53
>I know that there are at least two kludge workarounds from doing joins from on EF Model to another. The first is to create a view in one of the Model db and the second is a LINQ query that calls a method that joins to another Model.

Yup, EF is not designed to do cross context queries so that's out

>Does anyone know of anything else?

In cases like this I tend to fall back to plain ADO.NET and run raw SQL queries. In my business object layer (https://github.com/RickStrahl/WestwindToolkit/tree/master/Westwind.Data) I use a simple DAL component attached to the DbContext to provide easy raw SQL access which gives cross DB data access at least from a single server/connection.


>To complicate matters: What if I need to join an EF entity (table) to a FoxPro table using the VFP Oledb driver? (This question is similar to my other question on cascading FoxPro queries, but a little different.)

Same here - you can't do that with EF, but you sure can with ADO.NET and two separate connections pulling data from each source. As Paul pointed out you can pull the data into plain object lists and then use LINQ to merge the data as needed.

This is really no different then what you would do if you didn't have an ORM for your data access :-)

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform