BatchJob.StartNew(async(batchJob) => {
for (var i = 0; i < 10; i++)
{
x.Enqueue(() => SendEmail(i));
await doSomework(i)
}
}
If i call async method inside batchjob only back ground job will be created.
BatchJob.StartNew((batchJob) => {
for (var i = 0; i < 10; i++)
{
x.Enqueue(() => SendEmail(i));
doSomework(i).wait()
}
}
but when i use .wait() method it is working.