Quartz.Plugins.TimeZoneConverter 提供与 TimeZoneConverter 的集成,这有助于弥合 *nix 和 Windows 的差异。
安装
您需要将 NuGet 包引用添加到使用 Quartz 的项目中。
Install-Package Quartz.Plugins.TimeZoneConverter
使用
经典的基于属性的配置
var properties = new NameValueCollection
{
["quartz.plugin.timeZoneConverter.type"] = "Quartz.Plugin.TimeZoneConverter.TimeZoneConverterPlugin, Quartz.Plugins.TimeZoneConverter"
};
ISchedulerFactory schedulerFactory = new StdSchedulerFactory(properties);
使用调度程序构建器进行配置
var config = SchedulerBuilder.Create()
.UseTimeZoneConverter();
ISchedulerFactory schedulerFactory = config.Build();