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

            DevDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DevConsts.ConnectionStringName));

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