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

            CoreCMSDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CoreCMSConsts.ConnectionStringName));

            return(new CoreCMSDbContext(builder.Options));
        }
예제 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <CoreCMSDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 CoreCMSDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 CoreCMSDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }