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

            OlhDbContextConfigurer.Configure(builder, configuration.GetConnectionString(OlhConsts.ConnectionStringName));

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