Entity framework LinqToEntitiesDomainService包括

Entity framework LinqToEntitiesDomainService包括,entity-framework,wcf-ria-services,Entity Framework,Wcf Ria Services,为什么下面的第一个IQueryable在结果中包含客户条目,而后者没有 public IQueryable<Purchase> GetPurchases() { // this works - includes Customer in results return this.ObjectContext.Purchases.Include("Customer"); // this doesn't return from purchase in thi

为什么下面的第一个IQueryable在结果中包含客户条目,而后者没有

public IQueryable<Purchase> GetPurchases()
{

    // this works - includes Customer in results
    return this.ObjectContext.Purchases.Include("Customer");

    // this doesn't
    return from purchase in this.ObjectContext.Purchases.Include("Customer")
           join cust in this.ObjectContext.Customers 
           on purchase.CustomerId equals cust.CustomerId
           select purchase;                   

}
public IQueryable GetPurchases()
{
//这很有效-结果中包括客户
返回此.ObjectContext.Purchases.Include(“客户”);
//这并不重要
在此.ObjectContext.Purchases.Include中从购买中返回(“客户”)
在this.ObjectContext.Customers中加入cust
在购买时,CustomerId等于cust.CustomerId
选择购买;
}

在我的项目中,我有一个相当复杂的查询,它需要一个联接,我觉得奇怪的是,一种形式的查询有效,而另一种形式的查询无效。

可能重复的谢谢,事实上它是重复的。我想你现在可以结束问题了。在我结束之前,还需要3票。