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

            EMSDbContextConfigurer.Configure(builder, configuration.GetConnectionString(EMSConsts.ConnectionStringName));

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