EntityFramework.DynamicFilters icon indicating copy to clipboard operation
EntityFramework.DynamicFilters copied to clipboard

Support for Entity Framework 7

Open ghost opened this issue 10 years ago • 11 comments

Support is provided EF7 ?

ghost avatar Nov 16 '15 08:11 ghost

Sorry, EF 7 is not supported at this time. I'll leave this issue open until I have more to update.

Right now, all I know is that many of the EF classes and interfaces I need either don't exist any more, have been renamed, or I just haven't figured out which of the 27 NuGet packages I need to install to find them.

jcachat avatar Nov 17 '15 03:11 jcachat

As EntityFrameworkCore RC2 is released, do you have any update on that? Thanks.

hikalkan avatar Jun 20 '16 08:06 hikalkan

As of now, there are no lifecycle hooks in EF Core/7. See this issue where it is being tracked: https://github.com/aspnet/EntityFramework/issues/626.

Nothing can be done at all until they make that available.

jcachat avatar Jun 20 '16 13:06 jcachat

I see, thanks for sharing this.

hikalkan avatar Jun 20 '16 13:06 hikalkan

For anyone watching for this in EF Core, please see here: https://blogs.msdn.microsoft.com/dotnet/2017/05/12/announcing-ef-core-2-0-preview-1/

and search for "Global Query Filters".

I don't know how it compares to the functionality in this library but maybe it will meet your needs. And hopefully they will continue to expand it in future releases.

jcachat avatar Jul 20 '17 23:07 jcachat

Looks like IDbCommandInterceptor has been implemented. Any plans to support it? https://github.com/dotnet/efcore/issues/626

drewburlingame avatar Oct 12 '22 19:10 drewburlingame

Hello @drewburlingame ,

EF Core already have their own query filters: https://learn.microsoft.com/en-us/ef/core/querying/filters

So the question, I guess, is more what is missing now from EF Core global query filters that this library could bring?

JonathanMagnan avatar Oct 12 '22 22:10 JonathanMagnan

The problem with the existing query filters feature is that 'IgnoreQueryFilters' will ignore all filters. It's not possible to prevent filters from being accidently ignored. Using query filters for multitenancy is risky.

drewburlingame avatar Oct 13 '22 06:10 drewburlingame

Hello @drewburlingame ,

So the problem with EF Core filtering is that you cannot just ignore a specific filter, from what I understand. It is either all or nothing, which doesn't really work well with multi-tenancy scenarios since you want to always at least keep this one filter.

(For reference purposes, it looks to have been reported on this issue: https://github.com/dotnet/efcore/issues/8576, which also has a refused pull here: https://github.com/dotnet/efcore/pull/24892)

It might not be perfect due to limitation, but EF Plus already have QueryFilter that allow enabling/disabling one or many filters: https://entityframework-plus.net/ef-core-query-filter

I talked with my developer, and at this moment, we feel that re-writing EntityFramework.DynamicFilters would probably take us a lot of time (pretty much no code is compatible with EF Core) for something that will eventually come built-in with EF Core. So, unfortunately, I don't think this library will ever be ported to EF Core (at least, not directly by us).

JonathanMagnan avatar Oct 13 '22 13:10 JonathanMagnan

@JonathanMagnan thanks for the response. It's probably wise not to spend the time porting. I agree, it will likely be resolved in EF Core at some point.

On a side note, while the associated docs states it does not support EF Core, there have been responses to issues that left me wondering if it was planned or would be taken on at some point. It would be helpful to put an explicit statement in the readme that this does not support EF Core and there are no plans for it to ever support EF Core.

Cheers, Drew

drewburlingame avatar Oct 13 '22 13:10 drewburlingame

Good point,

I added a small text and will re-work it during the weekend and do the same on the website.

JonathanMagnan avatar Oct 13 '22 13:10 JonathanMagnan