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

            Core5DbContextConfigurer.Configure(builder, configuration.GetConnectionString(Core5Consts.ConnectionStringName));

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