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

            MODDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MODConsts.ConnectionStringName));

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