Open Liero opened 1 year ago
Note for triage: the issue here is that there is no navigation that can be used to configure the dependent as required.
@Liero There isn't currently a model building API to do this, but you can drop down to the underlying metadata and set IsRequiredDependent
. For example:
entity.HasOne<Material>()
.WithOne()
.HasForeignKey<MaterialInfo2>(e => e.MaterialCode)
.HasPrincipalKey<Material>(e => e.MaterialCode)
.IsRequired(true)
.Metadata.IsRequiredDependent = true;
worked for me. Should I close this issue, or you want to keep it open to track the missing api?
Please leave it open.
Question
I want to map multiple entities to the same table. I don't won't a navigation property as it would be artificial for my needs.
Why I'm getting this warning and can I get rid of it?
See demo: https://dotnetfiddle.net/wt4BSQ
Code
Provider and version information
EF Core version: 7.0.3 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET 7.0