0
我遇到的情況,我有3個實體Linq的動態查詢和包括非相關實體
class entityA
{
public Guid Id { get; set; }
public string NameA { get; set; }
}
class entityB
{
public Guid Id { get; set; }
public string NameB { get; set; }
public entityA EntityA { get; set; }
}
class entityC
{
public Guid Id { get; set; }
public Guid HistoryId { get; set; }
}
EntityA和entityB有關係,但entityC與任何人沒有關係。
要獲得entityA及相關entityB數據我可以做
db.entityA.Include(x=>x.entityB)
,但我不能做包括()與entityA和entityC因爲entityA和entityC之間沒有任何關係。
它是唯一可能與像波紋管LINQ查詢語法:
from A in entityA join C in entityC on A.Id equals C.HistoryId select A
有沒有什麼辦法可以包括()或者使用LINQ lambda語法加入entityA和entityC?
選中此http://stackoverflow.com/a/2767742/2224701 –
的可能的複製【如何做LINQ與方法語法SQL中加入?](http://stackoverflow.com/questions/3217669 /如何做-DO-A-加入在-LINQ到SQL的使用法,語法) –