报错信息:Invalid Cast. The update expression must be of type MemberInitExpression.

直译结果:无效的。更新表达式必须是MemberInitExpression类型。

下面是报错对应的写法:

await projectsRepository.BatchUpdateAsync(x => new Projects(2), x => projectIdList.Contains(x.Id));

下面是修正后的写法:

await projectsRepository.BatchUpdateAsync(x => new Projects { Status = 2 }, x => projectIdList.Contains(x.Id));

两种写法的区别一个是使用构造函数赋值,一个是使用类的属性赋值。看起来异常会在构造函数赋值时发生,等待扩展提供方修复 BUG,在修复前先使用这个方法顶着。

相关文章:

  • 2022-02-15
  • 2022-12-23
  • 2023-01-09
  • 2021-06-21
  • 2022-12-23
  • 2021-08-19
猜你喜欢
  • 2022-12-23
  • 2021-11-21
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2022-01-01
相关资源
相似解决方案