Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post-load of entity filtering/auth (after sql returns) #24093

Closed
Plasma opened this issue Feb 9, 2021 · 1 comment
Closed

Post-load of entity filtering/auth (after sql returns) #24093

Plasma opened this issue Feb 9, 2021 · 1 comment

Comments

@Plasma
Copy link

Plasma commented Feb 9, 2021

Hi,

I realise global query filters exist, but that’s difficult to use when validating complex business rules, because they can’t become a valid SQL query, so this won’t work for me.

Instead, I’d like to have a filter step I can hook into after the entity was hydrated from the query but before it’s returned to the caller.

At that point I could run complex business logic to perform validations and either filter the result or throw an exception.

@ajcvickers
Copy link
Member

@Plasma We have investigated such an interception point before and run into two main problems. First, calling this after each entity instance is materialized, which is something we plan to do, (see #15911) but this isn't very useful for graph processing since related entities will not yet have been loading. Pushing this even further out is problematic because EF Core doesn't control how the application consumes LINQ queries. Second, picking apart a constructed graph of entities while maintaining integrity of the graph (and tracking) is non trivial, and not something we want to encourage.

Generally the application has a better understanding of when a query is finished and so it would be better to implement this event at the application level.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants