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

            ContabDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ContabConsts.ConnectionStringName));

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