开发者

How to Use Like in Linq Dynamics?

开发者 https://www.devze.com 2023-02-02 22:54 出处:网络
I want to ach开发者_高级运维ieve something like this :- var DB = new DALDataContext(); DB.Domains.Where(\"Name Like @p0\",new [] {\"field\"});use String.Contains() property for this condition.

I want to ach开发者_高级运维ieve something like this :-

var DB = new DALDataContext(); DB.Domains.Where("Name Like @p0",new [] {"field"});


use String.Contains() property for this condition. something like this source.Where(x => x.Name.Contains("someName"));

Also you can use SqlMethods.Like() from System.Data.Linq.SqlClient namespace

example:

       `var query = from s in Source 
        where SqlMethods.Like(s.Name, "%someName%")
        select s;`
0

精彩评论

暂无评论...
验证码 换一张
取 消