首页 > 解决方案 > 为什么不建议在 EF Core 中使用带参数的 Compare() 方法?

问题描述

为什么不建议在 EF Core 中使用带参数的 Compare() 方法(例如 StringComparison.OrdinalIgnoreCase)?

我试过这样的实现:

var searchString = "abc";     
var result = items.Where(t => t.Name.ToString().Contains(searchString, StringComparison.OrdinalIgnoreCase);

items这里是 IQueryable

实际上这段代码有效,但我不确定它是否没有任何陷阱。明天我将提供它如何在 SQL 端执行的分析结果。

标签: c#entity-framework-core

解决方案


推荐阅读