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

            FirstBoilerPlateAppDbContextConfigurer.Configure(builder, configuration.GetConnectionString(FirstBoilerPlateAppConsts.ConnectionStringName));

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