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

            MyTestDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyTestConsts.ConnectionStringName));

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