I have the following two entities refering to one table using split table option from EF Core - this very simplified version:
class Account
int Id
Settings Settings
class Settings
int AccountId (maps to Id)
string PropertyX
From the documentation:
If all of the columns used by a dependent entity are NULL in the database, then no instance for it will be created when queried. This allows modeling an optional dependent entity, where the relationship property on the principal would be null. Note that this would also happen if all of the dependent's properties are optional and set to null, which might not be expected.
Is it possible to disable this behaviour? I have multiple columns with a lot of grouped behaviour that are default null.
Now the entity (Settings) won't be created by default. This means I have to nullcheck everywhere. I rather have Settings created with null values for all properties.
If I create the instance myself in the constructor of the parent entity (Account) the changes don't seem to be tracked, because I guess EF Core is not aware of the class.
Any solution?