I question why you are trying to serialize the whole IConfiguration
object. Why not just use the connectionstring as the method’s parameter instead? It would mean less overhead and be easier to read the code.
public void Configure(..., IConfiguration configuration)
{
...
RecurringJob.AddOrUpdate<RecurrentJobs>(x => x.DoRemindersJob(configuration.GetConnectionString("MySqlConnection")), "*/5 * * * *");
...
}
public void DoRemindersJob(string mySqlConnection)
{
Console.WriteLine("Starting reminder job");
string connectionString = mySqlConnection;
Console.WriteLine(connectionString);
}
If you need more a lot more parameters than just the connectionstring, create a basic serializable object with the properties you need.