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

            CompareXDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CompareXConsts.ConnectionStringName));

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