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

            TestApiDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TestApiConsts.ConnectionStringName));

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