ABPCMS.EntityFramework/Migrations/Configuration.cs

(完整代码) 1KB

using System.Data.Entity.Migrations;
using Abp.MultiTenancy;
using Abp.Zero.EntityFramework;
using ABPCMS.Migrations.SeedData;
using EntityFramework.DynamicFilters;

namespace ABPCMS.Migrations
{
    public sealed class Configuration : DbMigrationsConfiguration<ABPCMS.EntityFramework.ABPCMSDbContext>, IMultiTenantSeed
    {
        public AbpTenantBase Tenant { get; set; }

        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
            ContextKey = "ABPCMS";

        }

        protected override void Seed(ABPCMS.EntityFramework.ABPCMSDbContext context)
        {
            context.DisableAllFilters();

            if (Tenant == null)
            {
                //Host seed
                new InitialHostDbBuilder(context).Create();

                //Default tenant seed (in host database).
                new DefaultTenantCreator(context).Create();
                new TenantRoleAndUserBuilder(context, 1).Create();
            }
            else
            {
                //You can add seed for tenant databases and use Tenant property...
            }

            context.SaveChanges();
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。