-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
AutoInclude property of owned entities #34292
Comments
This configures Address as its own, separate non-owned entity type (i.e. with its own table), which conflicts with the other cnofiguration of it as owned - that's why you're getting the error. Have you considered simply configuring Address itself as Owned where its used, as opposed to using AutoInclude? |
It's already configured as owned and that's why I'm getting the exception, and that is all working correctly. I just want to AutoInclude a property on the owned type which you can't do at the moment. |
Sorry, I meant to ask why not configure Country as owned (as opposed to auto-include)? |
In this case Country is a list of possible/configured countries and also has relations to other entity types, so it can't be only owned by address. Wouldn't that just make it functionally the same as a string property named Country? |
Understood - no, if you want Country to be in its own table with addresses referencing it by foreign key, and joins every time you load it, this is indeed the right modeling; the alternative would be to indeed just have it as a string column with possibly a check constraint, this can be modeled either as a simple property or as an owned entity/complex type. In any case, I don't think there's currently a way to configure all navigations pointing to an entity type to be auto-loading (which is your original request) - @AndriySvyryd @ajcvickers does this ring any bells? |
This is essentially a duplicate of #2953 |
I want to be able to AutoInclude a property of an owned entity type.
Currently I have three tables that all have an owned Address.
This Address includes a Country, which I must include everywehere that the address is used.
I want to be able to include this Country automatically, so these includes everywhere:
Can be replaced by one global AutoInclude:
Currently this just produces the error
The entity type 'Address' cannot be configured as non-owned because it has already been configured as a owned. If you want to override previous configuration first remove the entity type from the model by calling 'Ignore'.
The text was updated successfully, but these errors were encountered: