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

            ServiceControlDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ServiceControlConsts.ConnectionStringName));

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