-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Global Query Filters filtering related entities #14151
Comments
Duplicate of #11691 |
Sorry I did search for similar issues but did not come across that other one |
@hisuwh I know this is an old issue but what approach did you end up taking with this? I'm currently dealing with the same scenario. Cheers. |
@jonesty I think we ended up not using global filters |
@hisuwh Thanks mate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are querying an entity and including an entity which has a global query filter. This entity is filtered out as consequence of this global query filter. This is either a bug or an undocumented feature but either way we need a workaround to this.
Steps to reproduce
Given this model:
I might have an API endpoint to return archived Authors and their posts.
Now say I call my API endpoint to return my blog post which is implemented like this:
This returns null because it appears to be filtering out the BlogPost because its author is archived. Now I realise I could add
.IgnoreGlobalFilters()
here but I do not want to do this because this is my generic endpoint to return BlogPosts, and I might later add another Global Filter (i.e. !Deleted).Possible Solutions
int? AuthorId
in the above example) - not sure if this is intended but this also needs documenting if soDeleted
for example but it doesn't make sense in my caseFurther technical details
EF Core version: 2.2.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer)
Operating system: Windows 10
IDE: isual Studio 2017 15.7.6
The text was updated successfully, but these errors were encountered: