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

            SimpleWebAppDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SimpleWebAppConsts.ConnectionStringName));

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