我从模型中生成了数据库,现在我注意到所有表都附加了一个“s”,然后将 Userid 对象转换为 SQL 中的 Userids。
当我运行代码时
Userid userid = db.Userids.Find(id);
给我这个错误: System.InvalidOperationException: '实体类型 Userid 不是当前上下文模型的一部分。'
所有表格末尾添加的“s”是否正确?
这是我得到的实际错误
System.InvalidOperationException
HResult=0x80131509
Message=The entity type Userid is not part of the model for the current context.
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>