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

            SeaBlogDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SeaBlogConsts.ConnectionStringName));

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