// This is fine.
builder
.HasMany<Customer>()
.WithOne(x => x.Tenant)
.HasForeignKey("tenant_id")
.IsRequired()
.OnDelete(DeleteBehavior.Restrict);
// This throws - System.InvalidOperationException: The entity type 'Address' cannot be configured as non-owned because it has already been configured as a owned. Use the nested builder in `OwnsOne` or `OwnsMany` on the owner entity type builder to further configure this type. If you want to override previous configuration first remove the entity type from the model by calling 'Ignore'.
builder
.HasMany<Address>()
.WithOne(x => x.Tenant)
.HasForeignKey("tenant_id")
.IsRequired()
.OnDelete(DeleteBehavior.Restrict);
// This is fine.
builder
.HasMany<Customer>()
.WithOne(x => x.Tenant)
.HasForeignKey("tenant_id")
.IsRequired()
.OnDelete(DeleteBehavior.Restrict);
// This throws - System.InvalidOperationException: The entity type 'Address' cannot be configured as non-owned because it has already been configured as a owned. Use the nested builder in `OwnsOne` or `OwnsMany` on the owner entity type builder to further configure this type. If you want to override previous configuration first remove the entity type from the model by calling 'Ignore'.
builder
.HasMany<Address>()
.WithOne(x => x.Tenant)
.HasForeignKey("tenant_id")
.IsRequired()
.OnDelete(DeleteBehavior.Restrict);