title: LINQ and AutoMapper
body: <p>I'm wondering if there is anything I can do to get this working as expected.  This works fine in my code:</p>
  
  <pre><code>        var roles = _securityContext.Set&lt;Role&gt;();
          var roleList = new List&lt;RoleDto&gt;();
          foreach (var role in roles)
          {
              roleList.Add(Mapper.Map&lt;Role, RoleDto&gt;(role)); 
          }
  
          return roleList;
  </code></pre>
  
  <p>But changing this to:</p>
  
  <pre><code>        var roles = _securityContext.Set&lt;Role&gt;();
  
          return roles.Select(role =&gt; Mapper.Map&lt;Role, RoleDto&gt;(role)).ToList();
  </code></pre>
  
  <p>Results in an error I've not seen before:</p>
  
  <p>"LINQ to Entities does not recognize the method 'Security.Dto.RoleDto MapRole,RoleDto' method, and this method cannot be translated into a store expression"</p>
  
  <p>I'm not sure if I can even do anything about this'problem' ... arguably the method that works is more readable anyway ...</p>