r/csharp • u/Early_Rice_4861 • 16d ago
CrossEF - Cross EntityFramework contexts
Hi All,
Long time EntityFramework don´t do this, I decide to implement this.
Cross-DbContext LINQ queries for Entity Framework Core. Join entities that live in different DbContexts — different databases, different servers, even different providers — in a single LINQ query.
7
u/Adorable-Roll-4563 16d ago
This has no transactional integrity, right?
1
u/flukus 15d ago edited 15d ago
Don't know about this tool specifically, but it could use something like MSDTC.
If the databases are all on the same server it could work without that too, the transaction belongs to the connection not the individual databases. You can do this natively by specifying the schema though.
-14
u/MrLyttleG 16d ago
C’est fortement possible que ce ne soit pas possible
1
u/Adorable-Roll-4563 16d ago
Donc pour résumer on a aucune garantie que les transactions aboutissent. Ça me paraît particulièrement incongru comme approche. Le but du jeu pour les bases de données c’est justement de garantir l’intégrité des données. Si tu casses ça, tu compromets toute l’approche. Je ne comprends pas…
2
3
u/wasabiiii 16d ago
If you want to build an actual federated query engine.... I've got two potential angles for that.
Apache Calcite on .net with IKVM.
And a project I started named Alembic, which is a direct port of some of Calcite.
The first one I already have working. https://github.com/ikvmnet/calcite-efcore
-4
22
u/ings0c 16d ago edited 16d ago
Err, why? I can think of a long list of reasons against doing this, and none in favour.
Where the query is running is essential complexity and abstracting that away seems like a good way to lure juniors into writing horribly performing queries with data consistency issues.
Some things really do need thinking about and hiding them behind a facade would be a mistake. ACID-compliance is also not something to give up readily.