我有2個數據庫表。一個帶有Master Recors,另一個帶有使用字典結構的詳細記錄。從字典表中選擇字段使用Linq聯接
我想從detailstable查詢一些字段,這是返回具有所有相同標題ID的多個行。
有沒有辦法使用LINQ加入兩個表
例如創建一個自定義記錄
主表: ID MasterName 日期 ...
細節表 ID MasterID Key Value
僞代碼: 從主在context.mastertable 加入詳細context.detailstable 上master.ID == detail.masterID 選擇新CustomClass { ID = master.ID, 名稱= master.MasterName 的CustomField =( detailsvalue.where key ==「customfield」)+(detailvalue.where key ==「customfield2」) };
希望有人能幫助我。
grtz Luuk Krijnen