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

            NhapMonCNPMDbContextConfigurer.Configure(builder, configuration.GetConnectionString(NhapMonCNPMConsts.ConnectionStringName));

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