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

            AgendaDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AgendaConsts.ConnectionStringName));

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