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

Unexpected behavior using Table Splitting #19779

Closed
draudrau opened this issue Feb 3, 2020 · 2 comments
Closed

Unexpected behavior using Table Splitting #19779

draudrau opened this issue Feb 3, 2020 · 2 comments

Comments

@draudrau
Copy link

draudrau commented Feb 3, 2020

Hi all,

I am using table splitting to model composition association between two entities.
You can look at the project in attachment.

First I create the parent entity (Blog) without explicitely defining the child entity (Author).
Then I try to get the Blog entity with loading the child (Author). I am expecting the Author entity is loading (with all its properties to null).
But I get an exception. Author is null.
I think it's not relevant. Table splitting is appropriate to model composition association between two entities. In a composition, the Blog entity can't exist without the Author entity.
When I get the Blog entity with the Author entity, the Author should never be null.

TableSplittingIssue.zip

Further technical details

EF Core version: 3.1.1
Database provider: (e.g. Microsoft.EntityFrameworkCore.SQLite)
Target framework: (e.g. .NET Core 3.1.1)
Operating system: Windows 10 Pro 1909
IDE: (e.g. Visual Studio 2019 16.3)

@ajcvickers
Copy link
Member

Duplicate of #12100.

@draudrau Not a great workaround, I know, but if one or more properties on the child are required, then you should get the behavior you want.

@draudrau
Copy link
Author

draudrau commented Feb 4, 2020

Thanks for the workaround, I am doing like that for now.
It's just a bit frustrating when I dont need required property.

Good job, EF Core is a great ORM, very pleasant to use.

@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

2 participants