我们有两个相关的表(库存,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 。 是否可以使用合并选择语句并加入两个具有多个条件的表?
在此先感谢..