-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Apply/disable filter per query #21
Comments
This is something I was thinking about recently too. And also to be able to set parameter values on a per query basis. But, I'm not sure there is a way that I can store that information attached to the query and then retrieve it again during the query parameter substitution. But I'll give it some more thought and see if I can some up with something. In the meantime, you can disable the filter (which is scoped to just that DbContext instance) before executing the query and then re-enable it after the query. It's not as clean as the syntax you're proposing, but it will get the job done. |
Thanks for your answer. I want to hear if you can find a good solution. |
random thought @JacHat how about an extension method for an IQueryableT that takes the context in so you can do that behind the scenes, the resulting code to give you literally everything you needed might look something like ...
its not perfect but it does allow the functionality and abstracts from the current querying code the extra calls to remove or add the filter as needed. You may not need the ReEnable bit on the end if you "track" the next call actually executed on the context from when the disable filter extension is called somehow (but I admit I don't know enough about what you are seeing in terms of variables to hand in such a context) |
Hi,
I want to use SoftDelete pattern. But, sometimes we may need to deleted entities. It should work per query. Example:
Is this possible? This is my project: https://github.com/aspnetboilerplate/aspnetboilerplate
The text was updated successfully, but these errors were encountered: