开发者

EntityRef adding unwanted record

开发者 https://www.devze.com 2023-01-27 20:43 出处:网络
I have an BookOrder object which has an EntityRef var to a Book object.The objects are linked by book Id.When inserting a new BookOrder record开发者_如何学运维, a new Book record also gets inserted in

I have an BookOrder object which has an EntityRef var to a Book object. The objects are linked by book Id. When inserting a new BookOrder record开发者_如何学运维, a new Book record also gets inserted into the book table. How do I stop this, and just insert the BookOrder record? Thanks in advance.


Okay, so after searching all day I was finally able find what my problem was and how to fix it at the following link.

http://aspnetking.blogspot.com/2009/03/foreign-key-issue-for-update-in-linq.html

Oh, and I'll be sure to accept this as the answer instead of the "answer" that was nothing more than someones attempt to up their reputation by providing no real help at all. Perhaps you should actually attempt to help someone if you intend to "answer" their question.


You cannot do this, as it would create an order for a book that doesn't exist.

That's why the book gets automatically created.

You should perhaps say what technology you'r using, that would make it easier to give a more accurate answer.

And you should also accept answers to your questions, it's important for your own reputation.

0

精彩评论

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