开发者

Modifying JobDataMap in Quartz.NET

开发者 https://www.devze.com 2023-01-26 11:53 出处:网络
I am creating a Quartz.NET application in C#, and creating a bunch of administration webpages (C#开发者_运维问答/ASP.NET) so users can easily create jobs, set datamap fields and edit datamap fields.

I am creating a Quartz.NET application in C#, and creating a bunch of administration webpages (C#开发者_运维问答/ASP.NET) so users can easily create jobs, set datamap fields and edit datamap fields.

I'm having some trouble editting jobs data maps though - any changes I make aren't saved at all. Is there anything I need to call after modifying the jobs data map?

Thanks


To anyone that has trouble too, this is easily solved by calling the AddJob method of the schedule variable


If you are using Quartz.Net version 1+ you must implement Quartz.IStatefulJob interface for your jobs.

public class MyJob : Quartz.IStatefulJob
{
    //...
}

This interface is obsolete in Quartz.Net 2+ so you have to add [Quartz.PersistJobDataAfterExecutionAttribute()] to your job class. Also you may need to add [Quartz.DisallowConcurrentExecutionAttribute()] to your job class.

[Quartz.PersistJobDataAfterExecutionAttribute()]
[Quartz.DisallowConcurrentExecutionAttribute()]
public class MyJob : Quartz.IJob
{
    //...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消