I wish to reference the OrderAddress
model twice in my Order
model; once as a ShippingAddress
and once as a Billing
The error is a little cryptic, so I'm not sure if this is the reason you're getting that particular error, but I do know it will cause some error, so you can start by fixing this:
What you have is two one-to-many relationships to the same model on one class. That's not a problem per se, but you have to treat them as separate. In other words, they can't both have a opposite relationship of Orders
, because relationally, there's no way to know which foreign key relationship should populate that list. If you simply change your fluent API definition to something like .WithMany(t => t.Orders_Shipping)
and .WithMany(t => t.Orders_Billing)
, I think that will clear up your error.