c# - Quartz.Net - How to associate an object to an IJobDetail -
i'm using quartz.net in project , want associate object ijobdetail.
i know there option of using
usingjobdata
but can put there strings, ints , such, want put there object, how do that?
so i've found answer after trying few things self, kinda wired not in documentation, whatever.
this how goes:
idictionary<string, object> data = new dictionary<string, object>(); data.add("data#1", mydata1); data.add("data#2", mydata2); ijobdetail job = jobbuilder.create<myjob>().setjobdata(new jobdatamap(data));
and in execute method in job receive this:
var data1 = context.jobdetail.jobdatamap.get("data#1");
Comments
Post a Comment