第一种情况
var db=new ECEntities();
var list=new []{"8","9"};
var result=from a in db.Products where list.Contains(a.SKU) select a;
result.Dump();
生成的sql:
SELECT
[Extent1].[LastModifiedTerminal] AS [LastModifiedTerminal],
[Extent1].[LianCoinFullUse] AS [LianCoinFullUse]
FROM [dbo].[Products] AS [Extent1]
WHERE [Extent1].[SKU] IN (N'8', N'9')
第二种情况
var db=new ECEntities();
var result=from a in db.Products where a.SKU.Contains("8") select a;
result.Dump();
生成的sql:
SELECT
[Extent1].[LianCoinFullUse] AS [LianCoinFullUse]
FROM [dbo].[Products] AS [Extent1]
WHERE [Extent1].[SKU] LIKE N'%8%'