Seeding method is inserting additional Entities with NULL values

前端 未结 1 676
执念已碎
执念已碎 2021-01-27 07:42

I am having this strange behavior all of a sudden (i have compared my files in version control (tfs) to be sure i did not change anything and i didn\'t found anything different)

相关标签:
1条回答
  • 2021-01-27 08:43

    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!

    0 讨论(0)
提交回复
热议问题