我們有兩個相關的表(庫存,inventoryLocalization)和T-SQL查詢此基礎上進行如下..轉換的T-SQL查詢的Linq與聚結以SQL和多個連接
select inv.[code],
coalesce(inL.name, inL2.name) as [name],
coalesce(inL.description, inL2.description) as [description]
from dbo.[inventory] inv
left join dbo.[inventoryLocalization] inL on inv.code = inL.code and inL.language = 'de'
left join dbo.[inventoryLocalization] inL2 on inv.code = inL2.code and inL2.language = 'en'
where inv.[code] like '15.' + '%'
order by inv.[code];
性能我們將嘗試從緩存中直接使用這些表,而不是直接從RDBMS中使用這些表。對於asp.net 4.0項目,由c#提供的 。 我們已經把這兩個表都用一個DataSet來處理,我們可以通過這個DataSet來訪問它們。
DataSet ds = UtilityCache.getCachedDataSet();
「ds.Tables [0]」 是庫存表和 「ds.Tables [1]」 是inventoryLocalization表
但我們如何可以轉換上述T-SQL語法LINQ2SQL 。 是否可以使用合併選擇語句並加入兩個具有多個條件的表?
在此先感謝..