Ejemplo n.º 1
0
        public DgERMDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <DgERMDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            DgERMDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DgERMConsts.ConnectionStringName));

            return(new DgERMDbContext(builder.Options));
        }
Ejemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <DgERMDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 DgERMDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 DgERMDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }