gaepdit / complaint-tracking

Complaint Tracking System
The Unlicense
1 stars 2 forks source link

Entity Framework model validation warning #710

Open dougwaldron opened 1 month ago

dougwaldron commented 1 month ago

Entity Framework is emitting the following warning when loading a Complaint:

warn: Microsoft.EntityFrameworkCore.Model.Validation[20606] The entity type 'Complaint.CallerAddress#IncompleteAddress' is an optional dependent using table sharing without any required non shared property that could be used 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. 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.

The same warning is emitted for the following properties (all Owned properties):

dougwaldron commented 1 month ago

Maybe (probably) not related to the above warnings, but consider saving Value objects using Complex Types.

dougwaldron commented 1 month ago

Ok, I tried complex types, and I don't think it will work here until https://github.com/dotnet/efcore/issues/31376 is fixed.