【问题标题】:Filter child elements in an ASP.NET Linq-to-Entities筛选 ASP.NET Linq-to-Entities 中的子元素
【发布时间】: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


    【解决方案1】:

    你可以找到答案in this tip

    【讨论】:

      猜你喜欢
      • 2017-03-20
      • 1970-01-01
      • 1970-01-01
      • 2023-03-06
      • 1970-01-01
      • 2010-09-30
      • 1970-01-01
      • 2010-10-25
      • 2023-01-13
      相关资源
      最近更新 更多