title: How to boost performance EF Linq to Entities
body: <p>I use asp.net 4 c# and EF 4.</p>
  
  <p>I'm profiling my application. I have this code which result expensive.</p>
  
  <p>I woud like to know if you know a better way to write it. I need to speed it up.</p>
  
  <pre><code>            string htmlhead = context.CmsOptions.SingleOrDefault(op =&gt; op.OptionId == 7).Value;
              if (htmlhead != null)
                  uxHtmlHead.Text = htmlhead;
              else
                  uxHtmlHead.Text = "No Html Head.";
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Useful article
  <a href="http://weblogs.asp.net/zeeshanhirani/archive/2010/09/20/which-one-is-faster-singleordefault-or-firstordefault.aspx" rel="nofollow">http://weblogs.asp.net/zeeshanhirani/archive/2010/09/20/which-one-is-faster-singleordefault-or-firstordefault.aspx</a></p>