相关疑难解决方法(0)

Linq:SqlFunctions.PatIndex vs string.Contains for string comparisson

相同查询的以下哪个版本的性能会更好:

版本1(string.Contains):

var query = db.Products
    .Where( p => p.Description.Contains( description ) );
Run Code Online (Sandbox Code Playgroud)

版本2(SqlFunctions.PatIndex):

var query = db.Products
    .Where( p => SqlFunctions.PatIndex("%" + description + "%",p.Description) > 0  );
Run Code Online (Sandbox Code Playgroud)

c# linq

4
推荐指数
1
解决办法
3831
查看次数

标签 统计

c# ×1

linq ×1