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

            HRDbContextConfigurer.Configure(builder, configuration.GetConnectionString(HRConsts.ConnectionStringName));

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