【发布时间】:2023-01-24 00:34:45
【问题描述】:
我正在处理包含超过 100.000 条记录的数据密集型表。我需要检索列并通过扩展方法中实现的逻辑更新它。
例如:
var updateResult = await _context.WebidPersons.ExecuteUpdateAsync(x => x.SetProperty(a => a.EmployeeInfo, x => x.EmployeeInfo.ReturnAsEncrypted());
扩展方法就是这样
public static string ReturnAsEncrypted(this string value)
{
// logic that encrypt the EmployeeInfo
}
输出异常
无法翻译 System.InvalidOperationException 表达式。附加信息:“SetProperty”的以下 lambda 参数不代表要设置的有效属性:“x => x.EmployeeInfo.ReturnAsEncrypted”。有关详细信息,请参阅https://go.microsoft.com/fwlink/?linkid=2101038。 源=Microsoft.EntityFrameworkCore.Relational
【问题讨论】: