Schema specified is not valid. Errors: The relationship was not loaded because the type is not available

后端 未结 8 1309
旧时难觅i
旧时难觅i 2021-02-05 02:53

I wish to reference the OrderAddress model twice in my Order model; once as a ShippingAddress and once as a Billing

8条回答
  •  不知归路
    2021-02-05 03:20

    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.

提交回复
热议问题