Search code examples
c#abp-framework

Remove prefix from Volo.Abp table names


I am trying to use ABP Framework Core 8.

After running Add-Migration and Update-Database, all of the created tables have Abp prefix.
Such as: AbpUsers, AbpRoles, AbpFeatures, ...

How can I remove Abp from table names?

Is it possible to remove prefix in free version for default tables?

Can I use ABP Framework for backend only not for frontend?

I have tried following:

  1. protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
    
        modelBuilder.ChangeAbpTablePrefix<Tenant, Role, User>(""); 
    }
    
  2. builder.Entity<IdentityUser>(b =>
    {
        b.ToTable("Users", AbpIdentityDbProperties.DbSchema);
    
    
    }); inside some override class in migrator.
    

Solution

  • Go to:

    public static class *YourProjectName*EfCoreEntityExtensionMappings{
    
    }
    

    Inside it there will be a method

    public static void Configure()
    

    Inside it there will be

    OneTimeRunner.Run(() =>
    {}
    

    Inside this scope, add:

    string newDbTablePrefix = "";
    AbpIdentityDbProperties.DbTablePrefix = newDbTablePrefix; //Identity
    

    It will rename AbpUsers to Users.