[英]How to remove table name prefix from aspnetboilerplate Core 2
I am trying to use aspnetboilerplate
Core 2 in MVC (not Angular version). 我正在尝试在MVC(不是Angular版本)中使用
aspnetboilerplate
Core 2。
After running Add-Migration and Update-Database , all of the created tables have Abp
prefix. 运行Add-Migration和Update-Database之后 ,所有创建的表都具有
Abp
前缀。
Such as: AbpUsers
, AbpRoles
, AbpFeatures
, ... 例如:
AbpUsers
, AbpRoles
, AbpFeatures
,...
How can I remove Abp
from table names? 如何从表名称中删除
Abp
?
I see some instructions but all of them are related to MVC5 version of aspnetboilerplate
. 我看到了一些说明,但所有说明都与MVC5版本的
aspnetboilerplate
。
Answered in this issue: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2382 在这个问题上回答: https : //github.com/aspnetboilerplate/aspnetboilerplate/issues/2382
For Entity Framework Core
对于实体框架核心
Override
OnModelCreating
and callmodelBuilder.ChangeAbpTablePrefix
.覆盖
OnModelCreating
并调用modelBuilder.ChangeAbpTablePrefix
。 Example:例:
protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.ChangeAbpTablePrefix<Tenant, Role, User>(""); // Removes table prefixes. You can specify another prefix. }
Remember to add
using Abp.Zero.EntityFrameworkCore;
记住要
using Abp.Zero.EntityFrameworkCore;
添加using Abp.Zero.EntityFrameworkCore;
to your code file in order to accessChangeAbpTablePrefix
extension method.到您的代码文件以访问
ChangeAbpTablePrefix
扩展方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.