-
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
Add an index convention #4445
Comments
Here is some code you can put in foreach (var type in modelBuilder.Model.GetEntityTypes())
{
foreach (var index in type.GetIndexes())
{
index.Relational().Name =
type.ClrType.Name
+ "_"
+ string.Join("_", index.Properties.Select(p => p.Name));
}
} You probably want to put it at the end so that it applies to indexes that you create in |
Closing as we also have #214 tracking a purpose built API to write your own conventions. |
Current code convert
|
Add an index convention, such as IIndexConvention, to allow customizing indexes on add (and possibly remove).
The specific case is I want to customize the name of the index, to line up with an existing naming convention. I am using IPropertyConvention and IForeignKeyConvention to similarly name columns and FK constraints.
The text was updated successfully, but these errors were encountered: