Example #1
0
        public PersonalsNewDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <PersonalsNewDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true);

            PersonalsNewDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DemoConsts.ConnectionStringPersonalsNewDbContext));

            return(new PersonalsNewDbContext(builder.Options));
        }
Example #2
0
 public override void PreInitialize()
 {
     Configuration.ReplaceService <IEfCoreTransactionStrategy, DbContextEfCoreTransactionStrategy>(DependencyLifeStyle.Transient);
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <PersonalsNewDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 PersonalsNewDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 PersonalsNewDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }