title: How to use FirstOrDefaultAsync() in async await WEB API's
body: <p>I have created one .NET Core API , where my all methods are asynchronous but there is one requirement like <code>GetBalance()</code> which just return one entity (record) only. </p>
  
  <p>I am not able to using <code>SingleOrDefaultAsync()</code>, getting error like does not contain a definition  for this. </p>
  
  <p>I am using simple basic EF Code First approach with no Repository pattern.</p>
  
  <p><strong>Here is my code example.</strong> </p>
  
  <pre><code>public async Task&lt;ResponseBalanceModel&gt; GetBalanceFor(int accountNumber)
  {
      var result = await _dbContext.Accounts.Where(x =&gt; 
               x.AccountNumber == accountNumber)
               .SingleOrDefaultAsync(); // this is not working.
  
      /*Below tried code are not working. 
      var result1 = await _dbContext.Accounts.Where(x =&gt; x.AccountNumber == accountNumber).SingleOrDefaultAsync();
  
      var result2 = await _dbContext.Accounts.FirstOrDefaultAsync(x =&gt; x.AccountNumber == accountNumber);
      */
   }
  </code></pre>
  
  <p>For more clarification </p>
  
  <p><a href="https://i.stack.imgur.com/vnooa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vnooa.png" alt="enter image description here"></a></p>
  
  <p>Reference of Entityframework in my project. (.NET Core)</p>
  
  <p><a href="https://i.stack.imgur.com/hqeyQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hqeyQ.png" alt="enter image description here"></a></p>