title: How to create a  Store Expression for entity framework
body: <p>I have this.</p>
  
  <pre><code>var ViewModel = repGeneric.GetListOf&lt;CompanyContact&gt;(p =&gt; p.CompanyID == 1).Select(s =&gt; new ContactViewModel()
              {
                  ContactType = _db.ContactTypeTexts.FirstOrDefault(p =&gt; p.ID == s.Contact.ContactType.ID).Txt
              });
  </code></pre>
  
  <p>I would like to put this piece of code</p>
  
  <blockquote>
    <p>_db.ContactTypeTexts.FirstOrDefault(p => p.ID == s.Contact.ContactType.ID).Txt</p>
  </blockquote>
  
  <p>in a function.
  <br />
  How can I do that.? Any Idea. I Try but that's give me this error : </p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize
    the method 'System.String GetTxt()'
    method, and this method cannot be
    translated into a store expression.</p>
  </blockquote>
  
  <p>Thanks </p>