title: How to invoke async methods in Hangfire?
body: <p>I have asp.net core API application and this is the first time i will be using HangFire.</p>
  
  <p>In .Net Core application all my methods are async. Based on <a href="https://stackoverflow.com/questions/32655143/what-are-the-circumstances-of-using-wait-when-calling-async-methods">SO Post</a> it's not good idea to use <code>wait()</code> while calling async method in hangfire.<br>
  Also as per the <a href="https://github.com/HangfireIO/Hangfire/issues/150" rel="noreferrer">hangfire support issue</a> in v1.6.0, async support was added. I am using version 1.6.12 but still i dont see async support.</p>
  
  <p>How do i call async method from <code>Enqueue</code>. Currently i am using <code>wait()</code> </p>
  
  <pre><code>public class MyController : Controller
  {
      private readonly Downloader _downlaoder;
      private readonly IBackgroundJobClient _backgroungJobClient;
      public MyController(Downloader downloader, IBackgroundJobClient backgroungJobClient)
      {
          _downlaoder = downloader;
          _backgroungJobClient = backgroungJobClient;
      }
  
      [HttpPost]
      public void Post([FromBody]IEnumerable&lt;string&gt; files)
      {
          _backgroungJobClient.Enqueue(() =&gt; _downloader.DownloadAsync(files).Wait());
      }
  }
  </code></pre>