title: Linq to Entities - NotSupportedException - dynamic type - string.Format
body: <p><br>
  I'm making the switch from Linq-to-SQL to Linq-to-Entities and in the process of conversion came across the error "LINQ to Entities does not recognize the method 'System.String Format(System.String, System.Object, System.Object)' method, and this method cannot be translated into a store expression".  The following code is the culprit.  I understand that this has to do the with dynamic type generation I am using below.  How can I still use the dynamic type and use L2E?</p>
  
  <pre><code>var query = _db.Persons.Where(p =&gt; p.PersonId == PersonId);
  if (query.Count() &gt; 0)
  {
    var data = query.Join(_db.Users, p =&gt; p.UserId, u =&gt; u.UserId, (p, u) =&gt; new
      {
        Id = p.PersonId,
        Name = string.Format("{0} {1}", p.FirstName, p.LastName),
        Phone = p.Phone,
        Email = u.Email
      }).Single();
    return data;
  }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  OK, feel a little stupid after @John Hartsock showed me the simple solution...<br>
  What if I wanted to do some more complex string manipulation?</p>