Closed Ephron-WL closed 1 year ago
Hi @Ephron-WL, I have the same problem - do you have any update on this?
Hi @Ephron-WL, I have the same problem - do you have any update on this?
I think I found a good solution. See this issue: https://github.com/zompinc/efcore-extensions/issues/5
The library is an extension on EF Core that uses the same expression tree evaluation technique that EF Core itself uses, so I think it is a more ideal approach to support CTEs. Now, it is important to note the issue I had with needing a subquery, which is addressed satisfactorily in the issue. The efcore-extensions author used as guidance for his work the work of the author of this library: https://github.com/PawelGerr/Thinktecture.EntityFrameworkCore . I really think we put together a good solution.
Extension do not support temporal tables yet.
@Ephron-WL Thanks for your fast response. Unfortunately, I have to confess the issue thread is a little bit hard to follow as it involves yet another library. That is a route I would like to avoid for now.
@sdanyliv What would be needed to add this capability? Are there some PRs or commits which can act like a blueprint for the required changes?
I went the way of making a hack (don't judge me 😟):
Using a ICommandInterceptor
to replace the normal tables names with the tables names + temporal query expression (🤢).
For my specific usecase it works.
But still, I'm interested where EF Core's TableExpression
would need to be handled inside of Linq2Db to add the needed "text snippet" to the query.
Will check what we can do here. Actually it needs support from linq2db
side.
Already released.
this...
...translates to this...
... which is correct except for it is missing the temporal table keywords in the CTE...
... it should be something like...
https://github.com/dotnet/efcore/blob/94be38cf68692d3e605175801add457936fa7331/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs
I'll attempt to implement a fix in linq2db and see if the PR will be accepted.