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

            BanchDbContextConfigurer.Configure(builder, configuration.GetConnectionString(BanchConsts.ConnectionStringName));

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