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

            DcsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SdtConsts.DcsConnectionStringName));

            return(new DcsDbContext(builder.Options));
        }
Esempio n. 2
0
 public override void PreInitialize()
 {
     if (SkipDbContextRegistration)
     {
         return;
     }
     Configuration.Modules.AbpEfCore().AddDbContext <DcsDbContext>(options =>
     {
         if (options.ExistingConnection != null)
         {
             DcsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
         }
         else
         {
             var configurationAccessor = IocManager.Resolve <IAppConfigurationAccessor>();
             var connectionString      = configurationAccessor.Configuration["ConnectionStrings:DcsEntity"];
             DcsDbContextConfigurer.Configure(options.DbContextOptions, connectionString);
         }
     });
 }