繁体   English   中英

Linq查询,包含哪些内容

[英]Linq Query, Where Contains

我有这个简单的查询:

SELECT     xObjectID, xObjectName
FROM         dbo.xObject
where  CONTAINS( xObjectRef, '1838 AND 238671')

我试图转换为linq,但我不能让它工作,它正在推动我的墙。

谢谢!

全文搜索与linq到sql不兼容。 您将不得不调用存储过程。

编辑:

或者你想要一个linq查询,它将返回与sql相同的结果集?

这对你有用吗? 这确实需要xObjectRef是的属性xObject

from obj in dbo.xObject
where obj.xObjectRef.Contains("1838") && obj.xObjectRef.Contains("238671")
select new { xObjectId = obj.xObjectId, xObjectName = obj.xObjectName}
var query = from c in context.xObject 
             where c.xObjectRef.Contains("1838") && c.xObjectRef.Contains("238671")
             select new { ObjectID = c.xObjectID, ObjectName = c.xObjectName };
   var  a = xObject.where(n=>n.Contains("1838") && n.Contains("238671") )).
                    Select(s=>new {xObjectID=s.xObjectID , xObjectName=s.xObjectName});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM