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

            DemoAppDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DemoAppConsts.ConnectionStringName));

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