title: How to write the SQL ORDER BY {value} DESC LIMIT statement in LINQ to Entities (Entity Framewok)?
body: <p>I'd trying to write the following SQL query in LINQ to Entities, how can I do that?</p>
  
  <pre><code>SELECT codigo FROM Vendas ORDER BY codigo DESC LIMIT 1;
  </code></pre>
  
  <p>I know how to use the <code>DESC</code>, but what about the <code>LIMIT 1</code>. I could write this peace of code with the thing I know, but it will obviously throw an exception if there is more than one row on table <code>Vendas</code>:</p>
  
  <pre><code>using (TccContext db = new TccContext())
  {
      var query = (from venda in db.Vendas
                   orderby venda.codigo descending // `LIMIT 1` in LINQ should be added here I think
                   select venda).SingleOrDefault();
  }
  </code></pre>
  
  <p>Thanks in advance.</p>