public WebAppDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <WebAppDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            DbContextOptionsConfigurer.Configure(
                builder,
                configuration.GetConnectionString(WebAppConsts.ConnectionStringName)
                );

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