最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Is it possible to override part of a global filter in EF? - Stack Overflow

programmeradmin4浏览0评论
  • I have 2 tables, called Users and UserGroups.
  • The Users table has a global filter to only return users with a Status of 'Active'.
  • The UserGroups table has a global filter to only return groups with an Owner who is 'Active'.

If I want to return a list of active users with their associated user groups, this works fine.

Now I want to return the list of all users, including the groups they belong to, so I add .IgnoreQueryFilters() to my query, and this works, but it also returns the user groups where the Owner is 'Inactive'. So I have to manually add the UserGroup filtering back into my query, and if the global filter ever changes, I have to add that change manually to this query.

Is there a way to override the filters on Users, but not the filters on UserGroups?

发布评论

评论列表(0)

  1. 暂无评论