DEV Community

Discussion on: How to rename Asp .Net Core 2.2 Identity Tables to not have AspNet prefix in EF Core

Collapse
 
sgermosen profile image
Starling Germosen

On netcore >2.2 this doesnt work, so, you need to change it to this

foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
var tableName = entityType.GetTableName();
if (tableName.StartsWith("AspNet"))
{
entityType.SetTableName(tableName.Substring(6));
}
}