开发者

ADO.NET EF Composite primary key - can not update foreign key

I have following entities:

ADO.NET EF Composite primary key - can not update foreign key

In my code I need to update the FKCategoryID开发者_开发知识库 in entity BudgetPost but I'm getting the following error:

FKCategoryID is part of the object's key information

Is it any way to update the key in this case or it's not possible?

Thanks in advance


Why is it a part of the composite key? As long as FKBudgetID is a part of the composite primary key you won't be able to modify it. If you want to enforce uniqueness in the combination of FKCategoryID and FKBudgetID, use a UNIQUE constraint instead.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜