public JPGZServicePostgreSqlDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <JPGZServicePostgreSqlDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            JPGZServicePostgreSqlDbContextConfigurer.Configure(builder, configuration.GetConnectionString(JPGZServiceConsts.PostgreSqlConnectionStringName));

            return(new JPGZServicePostgreSqlDbContext(builder.Options));
        }
        public override void PreInitialize()
        {
            Configuration.ReplaceService <IConnectionStringResolver, MyConnectionStringResolver>();
            //使用freeSql模块
            Configuration.Modules.AbpFreeSql().ConnectionString = GetConnectionString();

            if (!SkipDbContextRegistration)
            {
                if (!SkipSqlserverDbContextRegistration)
                {
                    Configuration.Modules.AbpEfCore().AddDbContext <JPGZServiceDbContext>(options =>
                    {
                        if (options.ExistingConnection != null)
                        {
                            JPGZServiceDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                        }
                        else
                        {
                            JPGZServiceDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                        }
                    });
                }
                if (!SkipMysqlDbContextRegistration)
                {
                    //配置mysql数据库
                    Configuration.Modules.AbpEfCore().AddDbContext <JPGZServiceMysqlDbContext>(options =>
                    {
                        if (options.ExistingConnection != null)
                        {
                            JPGZServiceMysqlDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                        }
                        else
                        {
                            JPGZServiceMysqlDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                        }
                    });
                }

                if (!SkipPostgreSqlDbContextRegistration)
                {
                    //配置PostgreSql数据库
                    Configuration.Modules.AbpEfCore().AddDbContext <JPGZServicePostgreSqlDbContext>(options =>
                    {
                        if (options.ExistingConnection != null)
                        {
                            JPGZServicePostgreSqlDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                        }
                        else
                        {
                            JPGZServicePostgreSqlDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                        }
                    });
                }
            }
        }