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

            MyCouldBookDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyCouldBookConsts.ConnectionStringName));

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