Seeding method is inserting additional Entities with NULL values

时光怂恿深爱的人放手 提交于 2019-12-02 10:19:32

EDIT I have created a test app to just be able to test things out and be 100%. I do not yet know why but i have the same relation as before (Price Entities only having 1 Product reference (that was creating a duplicate)) and i don't have a duplicate...

So i can have the relation i want which is 1 Price should only have 1 Product reference but i have absolutely no idea what is happening here ...

Changing the relation in the PurchasePrice Class of the Entity Product to a ICollection instead of 1 Single Product doesn't create a dupe (and creates a PurchasePriceProduct table).

Seems from the database logs (log4net) that due to the relation EF is first inserting a Product (NULL) for the PurchasePrice Reference of the Product , AND inserts the Product (NOT NULL) with its references ... (If anyone needs any clarification on this let me know ill do my best)

This post HAS MOVED TO HERE. I want to thank everyone that has contributed in any way!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!