喜欢与Linq to Entities [英] LIKE with Linq to Entities
本文介绍了喜欢与Linq to Entities的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道.Contains()
方法的确像LIKE %therm%
,.StartsWith()
方法的确像LIKE therm%
,而.EndsWith()
方法的确像LIKE %therm
,但是...
I know the .Contains()
method does like LIKE %therm%
, the .StartsWith()
method does like LIKE therm%
and the .EndsWith()
method like LIKE %therm
but...
有什么办法可以像下面在**Linq to Entities**
上那样?
Is there a way to do like below on **Linq to Entities**
?
SELECT * FROM [dbo].[Users] WHERE Name LIKE 'rodrigo%otavio%diniz%waltenberg'
PS:我在实体上使用LINQ.不是LINQ TO SQL
PS: I'M USING LINQ TO ENTITIES. NOT LINQ TO SQL
推荐答案
是的,您可以使用ESQL /查询生成器语法:
Yes, you can do this with ESQL/Query Builder syntax:
var matching = Context.Users.Where("it.Name LIKE 'rodrigo%otavio%diniz%waltenberg'");
这篇关于喜欢与Linq to Entities的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文