原始问题:
hangfire - 将多个hangfire实例与单个postgresql数据库一起使用,如何写代码
你可以使用Hangfire.PostgreSql这个第三方包来设置多个Hangfire实例,以及将它们连接到同一个PostgreSQL数据库。要设置多个Hangfire实例,你需要像这样写代码:
// Configure Hangfire for the first instance
var storageOptions = new PostgreSqlStorageOptions {
SchemaName = "hangfire1" };
GlobalConfiguration.Configuration.UsePostgreSqlStorage("ConnectionString", storageOptions);
// Configure Hangfire for the second instance
storageOptions = new PostgreSqlStorageOptions {
SchemaName = "hangfire2" }; GlobalConfiguration.Configuration.UsePostgreSqlStorage("ConnectionString", storageOptions);
Prev:你好请问如何缓解焦虑