You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The owned types page explains how to use value objects. The constructors page explains how to use parameterised ctors. But there is no mentioned of how to do that together.
See also dotnet/efcore#26398, which changed the message in EF7 to something like this:
No suitable constructor was found for entity type 'BlogNone'. The following constructors had parameters that could not be bound to properties of the entity type: cannot bind 'did' in 'BlogNone(string title, int did)'; cannot bind 'notTitle' in 'BlogNone(string notTitle, Guid? shadow, int id)'; cannot bind 'dummy' in 'BlogNone(string title, Guid? shadow, bool dummy, int id)'; cannot bind 'dummy', 'description' in 'BlogNone(string title, Guid? shadow, bool dummy, int id, string description)'. Note that only mapped properties can be bound to constructor parameters. Navigations to related entities, including references to owned types, cannot be bound.
The owned types page explains how to use value objects. The constructors page explains how to use parameterised ctors. But there is no mentioned of how to do that together.
EF will throw an exception due to that ctor. That is because
Bar
is an owned type, and it is treated as a navigation property.To make this work we must remove
Bar
from the ctor. EF will then run the ctor, and then populate the property separately.The page should also explicitly mention
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: