ef-core-2.0 - Find' 的类型为 'int',与 'long' 的属性类型不匹配
问题描述
实体。
[Table("OrderLines", Schema = "Sales")]
public class OrderLine { [Key] public long OrderLineID { get; set; } }
尝试通过 ID 获取实体
public virtual async Task<T> GetByIdAsync(object id)
{
if (id == null) throw new ArgumentNullException("Identifier is null");
return await _entities.FindAsync(id);
}
得到一个错误 System.AggregateException:“发生了一个或多个错误。(对'DbSet.Find'的调用位置0处的键值是'int'类型,与'long'的属性类型不匹配。) "
解决方案
推荐阅读
- jmeter - 在 JMeter 的 SMTP 采样器中获取错误 500
- swift - 使用未解决的标识符“DefaultConflictHandlers”
- javascript - 更改电子邮件后重新验证用户 Firebase React
- spring-boot - 使用 Spring Security 进行摘要身份验证:按预期收到 401,但带有两个 WWW-Authenticate 标头
- algorithm - 到达 DAG 中所有节点的最小节点子集
- reactjs - 如何在 React Native 的 App 文件夹中的 Swiper 中添加左右按钮
- javascript - 输入时输入元素改变顺序
- python - 安装 jython 后无法安装 pip 包
- mysql - MySQL ENUM 到 VARCHAR 转换问题
- html - 无法清除缓存以刷新网页