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

            ABPProjectDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ABPProjectConsts.ConnectionStringName));

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