Trying to use the lowercase naming convention and AspNet Core Identity, however the AspNet... tables are not affected by the convention. I noticed this when trying to create my own convention, but decided to use this package when I couldn't get my own to work correctly.
Looking at the below example, see that the AspNetRoles and AspNetUsers tables are PascalCase, but my Address entity is converted to lowercase. So it looks like this is partially working, but for some reason not with the AspNet... entities. Although, notice that the column names and primary key names are lowercase even for the AspNet... entities
As a workaround I am adding this convention and iterating over all entities and properties and lowercasing them here. It's working for me in my current project, but not sure if there will be some other issue later.
public class LowercaseNamingConvention : IModelFinalizingConvention
{
public void ProcessModelFinalizing(IConventionModelBuilder modelBuilder, IConventionContext<IConventionModelBuilder> context)
{
modelBuilder.Metadata.GetEntityTypes().ToList().ForEach(entityType =>
{
entityType.SetTableName(entityType.GetTableName().ToLower());
entityType.GetProperties().ToList().ForEach(property =>
{
property.SetColumnName(property.GetColumnName().ToLower());
});
});
}
}
Trying to use the lowercase naming convention and AspNet Core Identity, however the
AspNet...
tables are not affected by the convention. I noticed this when trying to create my own convention, but decided to use this package when I couldn't get my own to work correctly.Environment:
Usage in DbContext
Looking at the below example, see that the
AspNetRoles
andAspNetUsers
tables are PascalCase, but myAddress
entity is converted to lowercase. So it looks like this is partially working, but for some reason not with theAspNet...
entities. Although, notice that the column names and primary key names are lowercase even for theAspNet...
entitiesExample migration.
Workaround
As a workaround I am adding this convention and iterating over all entities and properties and lowercasing them here. It's working for me in my current project, but not sure if there will be some other issue later.