We have a listing Supplier
But now we also need to have some Domain data regarding this relationship.
Thus, in 99.9% of the domain code, we perform enumeration operations, for example product.Supplier == Suppliers.FedEx
But now we have also added product.SupplierInfo.CanAdjustPickupTimewhere SupplierInfois Entity, and not just a simple enumeration type.
I tried these configs
Property(p => p.Supplier)
.IsRequired()
.HasColumnName("SupplierId");
HasRequired(p => p.SupplierInfo)
.WithMany()
.HasForeignKey(p => p.Supplier);
This will not succeed using
ResultType of the specified expression is incompatible with the required type. The ResultType expression is "MyApp.Model.Suppliers", but the required type is' Edm.Int32. Parameter Name: keyValues [0]
Also tried
Property(l => l.Supplier)
.IsRequired()
.HasColumnName("SupplierId");
HasRequired(p => p.SupplierInfo)
.WithMany()
.Map(m => m.MapKey("SupplierId"));
This shutdown will give the good old
During model generation, one or more validation errors were detected:
SupplierId: Name: . 'SupplierId' .
SupplierId , HasForeignKey .SuppliedId == (int)Suppliers.FedEx .. .
, SupplierId , , DB.
?