示例#1
0
        public YoyoCmsTemplateDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <YoyoCmsTemplateDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            YoyoCmsTemplateDbContextConfigurer.Configure(builder, configuration.GetConnectionString(YoyoCmsTemplateConsts.ConnectionStringName));

            return(new YoyoCmsTemplateDbContext(builder.Options));
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <YoyoCmsTemplateDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 YoyoCmsTemplateDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 YoyoCmsTemplateDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }