Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for null owned types #17201

Closed
spottedmahn opened this issue Aug 16, 2019 · 1 comment
Closed

Add Support for null owned types #17201

spottedmahn opened this issue Aug 16, 2019 · 1 comment

Comments

@spottedmahn
Copy link

Describe what is not working as expected.

Owned entity types can't be null.

Reference navigations to owned entity types cannot be null unless they are explicitly mapped to a separate table from the owner

Source: Current shortcomings of Owned Entity Types

Exception message:

System.InvalidOperationException: The entity of type 'MyOwnedType' is sharing the table 'MyOwnerType' with entities of type 'MyOwnedType', but there is no entity of this type with the same key value that has been marked as 'Added'. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the key values.

Workarounds

Temporary Work-Around to Allow Null Value Objects

https://stackoverflow.com/questions/48063630/nullable-owned-types-in-ef-core

Steps to reproduce

https://github.com/spottedmahn/EntityFramework.Docs/blob/10a051c3e5ab0aca0d7c70df52bd833e92503f71/samples/core/Modeling/OwnedEntities/Program.cs#L23

Further technical details

EF Core version: 2.1.11
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Win 10
IDE: Visual Studio 2019 Preview 16.3 Preview 2

Sorry if I'm opening a duplicate request, I couldn't find one...

@smitpatel
Copy link
Member

smitpatel commented Aug 16, 2019

Duplicate of #9005

@smitpatel smitpatel marked this as a duplicate of #9005 Aug 16, 2019
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants