YESWEB数据库模型数据库补丁排除特定表


需求:

业务模块开发过程中,可能需要用到其他非本业务模块的表

这样如果直接创建数据库补丁的时候,会因为表重复而报错

 

方案:

修改Entities/EntitiesContext.cs的OnModelCreating方法,在改方法中设置需要排除的表结构

例子,需要排除base_user表

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "dotnet")
    {
        modelBuilder.Ignore<Tables.base_user>();
    }
}
GarsonZhang www.infnitee.com

 

这样,创建数据库补丁的时候,就不会生成base_user表相关的数据库脚本

版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
YES开发框架
评论列表

发表评论

评论内容
昵称: