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

            CoreDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CoreConsts.ConnectionStringName));

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