I have a relationship between two models but the relationship is not required, i.e. the first model which "belongs to" the other model can exists on its own.
class Item { [DefaultValue(0)] public int? OwnerId {get;set;} public Owner Owner { get;set; }}class Owner { ...}
class Item { [DefaultValue(0)] public int? OwnerId {get;set;} public Owner Owner { get;set; }}class Owner { ...}
So in essence, class
Item
Item
can stand on its own but it can also belong to someone.
I am getting this when trying to run the database update command for the seed data which has set the OwnerId to 0
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Items_Owners_OwnerId". The conflict occurred in database "<DB>", table "dbo.Owners", column 'Id'.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Items_Owners_OwnerId". The conflict occurred in database "<DB>", table "dbo.Owners", column 'Id'.