Reputation: 73
I have this simple query:
SELECT xObjectID, xObjectName
FROM dbo.xObject
where CONTAINS( xObjectRef, '1838 AND 238671')
Which i am trying to convert to linq but i can't get it to work, And it's driving me up the wall.
Thanks!
Upvotes: 1
Views: 239
Reputation: 148744
var a = xObject.where(n=>n.Contains("1838") && n.Contains("238671") )).
Select(s=>new {xObjectID=s.xObjectID , xObjectName=s.xObjectName});
Upvotes: 0
Reputation: 12786
var query = from c in context.xObject
where c.xObjectRef.Contains("1838") && c.xObjectRef.Contains("238671")
select new { ObjectID = c.xObjectID, ObjectName = c.xObjectName };
Upvotes: 1
Reputation: 17804
Does this work for you? This does require xObjectRef
to be a property of xObject
.
from obj in dbo.xObject
where obj.xObjectRef.Contains("1838") && obj.xObjectRef.Contains("238671")
select new { xObjectId = obj.xObjectId, xObjectName = obj.xObjectName}
Upvotes: 1
Reputation: 3253
Fulltext searches are not compatible with linq to sql. You will have to call a stored procedure.
Edit:
Or do you want a linq query that will return the same result set as the sql?
Upvotes: 1