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

            EVDbContextConfigurer.Configure(builder, configuration.GetConnectionString(EVConsts.ConnectionStringName));

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