-
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
Re-consider One Model to Rule Them All #7166
Labels
breaking-change
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
providers-beware
type-cleanup
Milestone
Comments
This was referenced Jan 24, 2017
ajcvickers
added a commit
that referenced
this issue
May 18, 2017
Part of #7166 Since we now build one model per database provider there is no need to allow relational and provider-specific overrides to exist together in the same model. This means that any relational annotation will always be prefixed with "Relational:" and never with, for example, "SqlServer:". Provider-specific annotations still use the provider prefix. This particularly advantageous for the consumer, since to read, for example, the table name, a consumer only ever needs to read `entityType.Relational().TableName;` instead of having to handle the case where it has been overridden for the current provider. Note: there is other API (e.g. ForSqlServerTableName) than can also be removed; that will be part of another PR.
ajcvickers
added a commit
that referenced
this issue
May 19, 2017
Part of #7166 Since we now build one model per database provider there is no need to allow relational and provider-specific overrides to exist together in the same model. This means that any relational annotation will always be prefixed with "Relational:" and never with, for example, "SqlServer:". Provider-specific annotations still use the provider prefix. This particularly advantageous for the consumer, since to read, for example, the table name, a consumer only ever needs to read `entityType.Relational().TableName;` instead of having to handle the case where it has been overridden for the current provider. Note: there is other API (e.g. ForSqlServerTableName) than can also be removed; that will be part of another PR.
ajcvickers
added a commit
that referenced
this issue
May 22, 2017
Part of #7166 Main scenario here is conditional behavior in OnModelCreating now that we build a different model per provider.
ajcvickers
added a commit
that referenced
this issue
May 23, 2017
Part of #7166 Main scenario here is conditional behavior in OnModelCreating now that we build a different model per provider.
ajcvickers
added a commit
that referenced
this issue
May 24, 2017
Part of #7166 Main scenario here is conditional behavior in OnModelCreating now that we build a different model per provider.
ajcvickers
added a commit
that referenced
this issue
May 25, 2017
Part of #7166 Code can instead use ```C# if (Database.IsSqlServer()) { modelBuilder.HasColumnName("MySqlServerName"); } ```
ajcvickers
added a commit
that referenced
this issue
May 26, 2017
…itly Issue #8034, possible because of #7166 The idea here is to generate type mappings at model building type and then store them in the model. This allows `property.RelationalAnnotationNames().ColumnType` to always return the store type. The solution is not perfect: - A convention runs when the model is built, which means that ColumnType will remain null during OnModelCreating. This could be changed by lots of conventions that run whenever something that could change the mapping is changed. - Because this is done by convention, and because conventions are not always run (e.g. ModelSnapshot, HistoryTable, using the ModelBuilder directly with an empty convention set) it means sometimes type mappings are not available. However, in the normal application scenario, they will always be available. I will file an issue to look at these things post 2.0.
ajcvickers
added a commit
that referenced
this issue
May 26, 2017
…itly Issue #8034, possible because of #7166 The idea here is to generate type mappings at model building type and then store them in the model. This allows `property.RelationalAnnotationNames().ColumnType` to always return the store type. The solution is not perfect: - A convention runs when the model is built, which means that ColumnType will remain null during OnModelCreating. This could be changed by lots of conventions that run whenever something that could change the mapping is changed. - Because this is done by convention, and because conventions are not always run (e.g. ModelSnapshot, HistoryTable, using the ModelBuilder directly with an empty convention set) it means sometimes type mappings are not available. However, in the normal application scenario, they will always be available. I will file an issue to look at these things post 2.0.
ajcvickers
added a commit
that referenced
this issue
May 26, 2017
…itly Issue #8034, possible because of #7166 The idea here is to generate type mappings at model building type and then store them in the model. This allows `property.RelationalAnnotationNames().ColumnType` to always return the store type. The solution is not perfect: - A convention runs when the model is built, which means that ColumnType will remain null during OnModelCreating. This could be changed by lots of conventions that run whenever something that could change the mapping is changed. - Because this is done by convention, and because conventions are not always run (e.g. ModelSnapshot, HistoryTable, using the ModelBuilder directly with an empty convention set) it means sometimes type mappings are not available. However, in the normal application scenario, they will always be available. I will file an issue to look at these things post 2.0.
ajcvickers
added a commit
that referenced
this issue
May 26, 2017
Part of #7166 Code can instead use ```C# if (Database.IsSqlServer()) { modelBuilder.HasColumnName("MySqlServerName"); } ```
Done enough for preview2, moving out for any remaining work. |
ajcvickers
added a commit
that referenced
this issue
May 26, 2017
…itly Issue #8034, possible because of #7166 The idea here is to generate type mappings at model building type and then store them in the model. This allows `property.RelationalAnnotationNames().ColumnType` to always return the store type. The solution is not perfect: - A convention runs when the model is built, which means that ColumnType will remain null during OnModelCreating. This could be changed by lots of conventions that run whenever something that could change the mapping is changed. - Because this is done by convention, and because conventions are not always run (e.g. ModelSnapshot, HistoryTable, using the ModelBuilder directly with an empty convention set) it means sometimes type mappings are not available. However, in the normal application scenario, they will always be available. I will file an issue to look at these things post 2.0.
Looked at the value generator stuff and decided to not change it for now. Some generators need to access scoped services, which can't be done in an obvious way if they are configured directly on the model. Maybe come 3.0 we'll revisit... ;-) |
ajcvickers
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
May 27, 2017
25 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking-change
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
providers-beware
type-cleanup
Many moons ago we decided to follow the path of One Model to Rule Them All. That is, the ability to create a single model that can be used by all providers. To this end:
However, several aspects of where we have ended up mean that we may want to reconsider this:
Switching to one model per provider would have the following advantages:
Note that provider-agnostic migrations would still be possible in the same way they are today--by adding code to switch on the current provider in an edited migration.
The text was updated successfully, but these errors were encountered: