I'm using EF Core.
My Customer entity has properties Address1, Address2, and AddressFull.
Depending on which system sends me the data, I may receive Address1 and Address2, or I may receive AddressFull.
So I need:
- EITHER
Address1andAddress2required, andAddressFullnot-required - OR
Address1andAddress2not-required, andAddressFullrequired
So I have:
entityTypeBuilder.Property(p => p.Address1).IsRequired(false);
entityTypeBuilder.Property(p => p.Address2).IsRequired(false);
entityTypeBuilder.Property(p => p.AddressFull).IsRequired(false);
But this config does not properly map to my domain, and I want to enforce the logic. Is that possible in EF Core?