title: Get Dictionary value in IQueryable LINQ to Entities query
body: <p>I have to support multiple languages in production application.</p>
  
  <p>There are lot of Entity Framework queries that gets data from database as deferred IQueryable list like this:</p>
  
  <pre><code>public IQueryable&lt;Request&gt; GetDeferredRequests()
  {
      return _dbContext.Set&lt;Request&gt;();
  }   
  </code></pre>
  
  <p>POCO class looks like this:</p>
  
  <pre><code>public partial class Request
  {
      public int RequestID { get; set; }
  
      public string StatusName { get; set; }
  
      public string RequestType { get; set; }
  }
  </code></pre>
  
  <p>Data Transfer Object looks like this:</p>
  
  <pre><code>public class RequestDTO
  {
      public int RequestID { get; set; }
  
      public string StatusName { get; set; }
  
      public string RequestType { get; set; }
  }
  </code></pre>
  
  <p>After that I map the EF POCO entity to Data Transfer Object. To support multiple languages I want to get resource value by database value in mapping like the following method:</p>
  
  <pre><code>public IQueryable&lt;RequestDTO&gt; MapRequests(IQueryable&lt;Request&gt; requests)
  {
        Dictionary&lt;string, string&gt; resoures = new Dictionary&lt;string, string&gt;();
  
        System.Resources.ResourceSet resources = DatabaseResources.ResourceManager.GetResourceSet(new System.Globalization.CultureInfo("en"), true, true);
  
        foreach (DictionaryEntry resource in resources)
        {
            resoures.Add(resource.Key.ToString(), resource.Value.ToString());
        }
  
        return requests.Select(c =&gt; new RequestDTO()
        {
            RequestID = c.RequestID,
            StatusName =  resoures.Single(r =&gt; r.Key == c.StatusName).Value,
            RequestType = resoures.Single(r =&gt; r.Key == c.RequestType).Value
        });
  }
  </code></pre>
  
  <p>The problem is that the last command throws the following exception:</p>
  
  <pre><code>LINQ to Entities does not recognize the method 'System.String get_Item(System.String)' method, and this method cannot be translated into a store expression.
  </code></pre>
  
  <p>Unfortunatelly the converting IQueryable to IEnumerable by ToList() is not an option, because I do not want to move list to memory. </p>