Ejemplo n.º 1
0
        public HackatonHotelsDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <HackatonHotelsDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            HackatonHotelsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(HackatonHotelsConsts.ConnectionStringName));

            return(new HackatonHotelsDbContext(builder.Options));
        }
Ejemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <HackatonHotelsDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 HackatonHotelsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 HackatonHotelsDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }