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

            SatemDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SatemConsts.ConnectionStringName));

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