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

            NewDemoDbContextConfigurer.Configure(builder, configuration.GetConnectionString(NewDemoConsts.ConnectionStringName));

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