在应用Quartz.Net 1.0或从SVN获取代码自行编译程序集,当使用数据库作为Job Store时,假如系统时区设置不当,Quartz.Net将无法正常执行。错误出在StdAdoDelegate.cs中的967行(标红处),此处应该修改为TimeZoneInfo.Id(C# 3.5)。
///
<summary>
/// Insert the cron trigger data.
/// </summary>
/// <param name="conn"> the DB Connection </param>
/// <param name="trigger"> the trigger to insert </param>
/// <returns> the number of rows inserted </returns>
public virtual int InsertCronTrigger(ConnectionAndTransactionHolder conn, CronTrigger trigger)
{
using (IDbCommand cmd = PrepareCommand(conn, ReplaceTablePrefix(SqlInsertCronTrigger)))
{
AddCommandParameter(cmd, 1 , " triggerName " , trigger.Name);
AddCommandParameter(cmd, 2 , " triggerGroup " , trigger.Group);
AddCommandParameter(cmd, 3 , " triggerCronExpression " , trigger.CronExpressionString);
AddCommandParameter(cmd, 4 , " triggerTimeZone " , trigger.TimeZone.StandardName);
return cmd.ExecuteNonQuery();
}
}
/// Insert the cron trigger data.
/// </summary>
/// <param name="conn"> the DB Connection </param>
/// <param name="trigger"> the trigger to insert </param>
/// <returns> the number of rows inserted </returns>
public virtual int InsertCronTrigger(ConnectionAndTransactionHolder conn, CronTrigger trigger)
{
using (IDbCommand cmd = PrepareCommand(conn, ReplaceTablePrefix(SqlInsertCronTrigger)))
{
AddCommandParameter(cmd, 1 , " triggerName " , trigger.Name);
AddCommandParameter(cmd, 2 , " triggerGroup " , trigger.Group);
AddCommandParameter(cmd, 3 , " triggerCronExpression " , trigger.CronExpressionString);
AddCommandParameter(cmd, 4 , " triggerTimeZone " , trigger.TimeZone.StandardName);
return cmd.ExecuteNonQuery();
}
}