Linq to Entities - 向下钻取过滤器 (Asp.net)
我一直在寻找一种在 linq 的实体集合上执行多个“where”过滤器的好方法。有很多网站在侧面使用过滤器进行搜索,例如 eBay。
所使用的技术称为“向下钻取”过滤器。现在,我正在尝试找到在使用 Linq-to-Entities 的 3 层模型中实现此技术的正确方法。
该技术使用早期使用的接收实体集合,并通过某种过滤器缩小范围,但存在多个过滤器,即使在同一过滤“类别”内也可以应用和删除这些过滤器。
希望有人为我找到正确的教程链接或如何正确使用它的方法。
I've been searching for a good way of doing multiple "where" filters on an entity collection from linq. There are lots of sites that use a filter for their searches on the side, like ebay.
The technique used is called a "drill down" filter. Now I'm trying to find the right way of implementing this technique in my 3-tier model working with Linq-to-Entities.
The technique uses the earlier used received entity collection and narrows it down with some kind of filter, but there are multiple filters which can both be applied and removed even within the same "category" of filtering.
Hope somebody finds me the right link to a tutorial or a method of how to use this in a proper way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我的经验,侧面的每个“过滤器”都映射到数据库中的一个字段。这使得过滤器变得简单:
显然你可以在有意义的地方替换
.Equals()
,我已经在几个网络应用程序上使用了它,并取得了巨大的成功。当您想要的过滤器不直接映射到数据库中的字段时,这会变得有点棘手,但可以采用类似的方法。In my experience, each "filter" on the side maps to a field in the database. This makes it simple to do a filter:
Obviously you can substitue
.Equals()
where it makes sense, I've used this on several webapps with great success. This becomes a bit more trickey when the filters you want do not map directly to fields in your database, but a similar approach can be taken.