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

            ABP_Web_CoreDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ABP_Web_CoreConsts.ConnectionStringName));

            return(new ABP_Web_CoreDbContext(builder.Options));
        }
コード例 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <ABP_Web_CoreDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 ABP_Web_CoreDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 ABP_Web_CoreDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }