使用Quartz.net配置ADOJobStore

aca*_*dia 25 quartz-scheduler quartz.net

你如何使用Quartz.net设置一个jobstore.他们在网站上的教程对我没有帮助.

在这个页面虽然有步骤 http://quartznet.sourceforge.net/tutorial/lesson_9.html 我无法得到如何设置这个

org.quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz 
Run Code Online (Sandbox Code Playgroud)

谢谢

Mar*_*hma 41

以下是Quartz.NET示例13中编程配置的改编示例:

NameValueCollection properties = new NameValueCollection();

properties["quartz.scheduler.instanceName"] = "TestScheduler";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "true";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
// if running MS SQL Server we need this
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";

properties["quartz.dataSource.default.connectionString"] = "Server=(local);Database=quartz;Trusted_Connection=True;";
properties["quartz.dataSource.default.provider"] = "SqlServer-20";

// First we must get a reference to a scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler sched = sf.GetScheduler();
Run Code Online (Sandbox Code Playgroud)

您还可以使用基于属性文件的方法(.config文件)实现相同的功能.

  • 您应该能够使用配置文件中的<quartz>部分列出所有这些属性,并使用stadard <add key ="key-for-property"value ="value-for-property"/>模式.那么你根本不需要编程配置. (2认同)
  • 这里有一些更有用的信息:http://stackoverflow.com/questions/3821804/ado-net-with-quartz-net/21786658#21786658 (2认同)