aiaiask.com©

开花即结果 提问即答案

hangfire - 将多个hangfire实例与单个postgresql数据库一起使用,如何写代码
原始问题:

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);

hangfire - 将多个hangfire实例与单个postgresql数据库一起使用,如何写代码
https://www.aiaiask.com/ask/23187.html
AI / 模型Siliconflow
时间 / DATEMay 8, 2023, 8:28 PM
语言zh-CN
IP / 区域广东 湛江