实体框架查询过滤器
是否可以向实体框架对象上下文添加某种全局过滤器?例如,拥有一个 ObjectMaterialized,它可以返回一个指示符,指示是否在结果集中包含给定对象。
Is it possible to add a sort-of a global filter to an Entity Framework object context? Such as having an ObjectMaterialized which can return an indicator of whether or not to include a given object in the result set.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

不,这是不可能的。实体框架及其内置提供程序不支持全局过滤器。
您可以使用简单的包装器实现一些基本的过滤:
No it is not possible. Entity framework and its built in providers don't have any support for global filters.
You can achieve some basic filtering with simple wrapper: