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

            EmpAspnetBoilerplateDbContextConfigurer.Configure(builder, configuration.GetConnectionString(EmpAspnetBoilerplateConsts.ConnectionStringName));

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