Quartz.Plugins.TimeZoneConverter 提供与 TimeZoneConverter 的集成,这有助于弥合 *nix 和 Windows 的差异。

安装

您需要将 NuGet 包引用添加到使用 Quartz 的项目中。

  1. Install-Package Quartz.Plugins.TimeZoneConverter

使用

经典的基于属性的配置

  1. var properties = new NameValueCollection
  2. {
  3. ["quartz.plugin.timeZoneConverter.type"] = "Quartz.Plugin.TimeZoneConverter.TimeZoneConverterPlugin, Quartz.Plugins.TimeZoneConverter"
  4. };
  5. ISchedulerFactory schedulerFactory = new StdSchedulerFactory(properties);

使用调度程序构建器进行配置

  1. var config = SchedulerBuilder.Create()
  2. .UseTimeZoneConverter();
  3. ISchedulerFactory schedulerFactory = config.Build();