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

            SchoolAwesomeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SchoolAwesomeConsts.ConnectionStringName));

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