在我的数据库中,我有一列定义为唯一索引。我从DB生成了我的EF模型(我不知道这个唯一性是如何被转换为模型的,我该如何检查它?)。
当我尝试使用更新唯一的非主键
entity.Users.ApplyCurrentValues(user);
我碰到下面的错误记录来更新这个字段:
An object with a key that matches the key of the supplied object could not be found in the ObjectStateManager. Verify that the key values of the supplied object match the key values of the object to which changes must be applied.
如何更新独特的(非主!)场?
对于查看您的用户模型非常有用。 – dbugger