Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EF Joins across one or more Models
Message
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01595692
Message ID:
01595781
Vues:
54
>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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform