-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
At https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-6.0/breaking-changes#old-behavior it reads:
System.InvalidOperationException: Entity type 'ContactInfo' is an optional dependent using table sharing and containing other dependents without any required non shared property to identify whether the entity exists. If all nullable properties contain a null value in database then an object instance won't be created in the query causing nested dependent's values to be lost. Add a required property to create instances with null values for other properties or mark the incoming navigation as required to always create an instance.
Can't you show an example of how to achieve "mark the incoming navigation as required to always create an instance", please?
For instance this does not work, because the IsRequired() method does not exist:
builder.OwnsOne(p => p.Value, ot =>
{
ot.Property(d => d.Street);
ot.Property(p => p.Location).;
ot.Property(p => p.PostalCode);
ot.Property(p => p.City);
ot.Property(p => p.Country);
}).IsRequired();