【发布时间】:2009-06-18 16:15:46
【问题描述】:
我有以下几种情况:
TABLE Customers (
CustomerID int,
etc... )
TABLE Orders (
OrderID int,
CustomerID int,
Active bit,
etc... )
我在使用 Linq-to-Entities 的 ASP.NET MVC Web 应用程序中使用它。我想选择所有客户并填充 Customer.Orders 导航属性,并且应该只填充 Active==true 的订单。
我看到了其他指向DataLoadOptions.AssociateWith 的问题,但似乎我无法在 ASP.NET 中使用它。我也见过this article,但在我列举客户时,我似乎需要在我的视图中调用 CreateSourceQuery()。我想这是可能的,但似乎打破了 MVC 范式。
这似乎与“Filter child collection using a child collection of the child”的情况类似,只是我需要解决方案来解决 Linq-to-Entities 而不是 NHibernate。谢谢!
【问题讨论】:
标签: asp.net asp.net-mvc linq entity-framework linq-to-entities