title: Does AutoMapper support Linq?
body: <p>I am very interested in Linq to SQL with Lazy load feature. And in my project I used AutoMapper to map DB Model to Domain Model (from <code>DB_RoleInfo</code> to <code>DO_RoleInfo</code>). In my repository code as below:</p>
  
  <pre><code>    public DO_RoleInfo SelectByKey(Guid Key)
      {
          return SelectAll().Where(x =&gt; x.Id == Key).SingleOrDefault();
      }
  
      public IQueryable&lt;DO_RoleInfo&gt; SelectAll()
      {
          Mapper.CreateMap&lt;DB_RoleInfo, DO_RoleInfo&gt;();
          return from role in _ctx.DB_RoleInfo
                 select Mapper.Map&lt;DB_RoleInfo, DO_RoleInfo&gt;(role);
      }
  </code></pre>
  
  <p><code>SelectAll</code> method is run well, but when I call <code>SelectByKey</code>, I get the error:</p>
  
  <blockquote>
    <p>Method “RealMVC.Data.DO_RoleInfo MapDB_RoleInfo,DO_RoleInfo” could not translate to SQL.</p>
  </blockquote>
  
  <p>Is it that Automapper doesn't support Linq completely?</p>
  
  <p>Instead of Automapper, I tried the manual mapping code below:</p>
  
  <pre><code>public IQueryable&lt;DO_RoleInfo&gt; SelectAll()
  {
      return from role in _ctx.DB_RoleInfo 
      select new DO_RoleInfo 
      {
          Id = role.id,
          name = role.name,
          code = role.code
      };
  }
  </code></pre>
  
  <p>This method works the way I want it to.</p>