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

            KhoaLuanDbContextConfigurer.Configure(builder, configuration.GetConnectionString(KhoaLuanConsts.ConnectionStringName));

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