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

            ABPEasyWebCreationDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ABPEasyWebCreationConsts.ConnectionStringName));

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