-
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
Indexes specified by attribute do not change type mappings appropriately #21133
Comments
IndexAttributeConvention runs after TypeMappingConvention causing issue. |
|
@AndriySvyryd Can you explain more why this is necessary and what would go in these methods?
|
@lajones There are two problems with
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
foreach (var index in entityType.GetDeclaredIndexes())
{
index.SetDatabaseName("My" + index.Name);
}
} In |
So would the following be correct?
|
@lajones Yes |
When I have this entity type:
And configure it like this:
Then EF uses the "key or index" mapping for the string type, which results in this:
Notice that
nvarchar(450)
is used.However, if I do this:
Then creating the database throws because Name is still using
nvarchar(max)
.The text was updated successfully, but these errors were encountered: