开发者

Update Unique keys in Entity Framework

开发者 https://www.devze.com 2023-03-16 15:57 出处:网络
I have one view and one of its fields is Email (UK-Unique Key). When some user do login in my web system and update the email. Happens one problem he can\'t change his email.

I have one view and one of its fields is Email (UK-Unique Key).

When some user do login in my web system and update the email. Happens one problem he can't change his email.

After Appears the message:"the property is part of the object's key information and cannot be开发者_高级运维 modified"


I don't think you can or should update unique key fields. Have you considered making an integer identity field the unique key for the user, so that the email address could be modified?

You can still enforce uniqueness of the email field by adding an additional constraint in the database, or through business logic.

0

精彩评论

暂无评论...
验证码 换一张
取 消