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

            DouanaDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DouanaConsts.ConnectionStringName));

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