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

            MyportalDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyportalConsts.ConnectionStringName));

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