0

I am using Quartz.Net scheduler library in .Net Core. And it has an extension method. But I want to use it dynamically. How can I pass generic type of my classes from its string key ? RUQRAktarim is my generic class. I have another classes like it. And I don't want to repeat code which is in below. I have my class names as a string in appsettings. So i want to repeat this code from string class names. [app.UseQuartzJob<"classname">]

Original code like that :

app.UseQuartzJob<RUQRAktarim>(new List<TriggerBuilder>
{
    TriggerBuilder.Create()
                  .WithIdentity("Trigger" + i.ToString(),jobName)
                  .WithCronSchedule(cronExpression,
                       x => x.WithMisfireHandlingInstructionFireAndProceed()),
});
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
Umut
  • 1
  • Take a moment to read through the [editing help](//stackoverflow.com/editing-help) in the help center. Formatting on Stack Overflow is different than on other sites. The better your post looks, the easier it is for others to read and understand it. – gunr2171 Mar 05 '21 at 21:22
  • How about using a loop to register all your types? – Xerillio Mar 05 '21 at 21:26
  • I will do it.But my loop key will be string class name. – Umut Mar 05 '21 at 21:28

0 Answers0