title: Return Enum Name from Integer in LINQ Database Query
body: <p>I would like to return the string value of an enum stored as an integer in a database using a LINQ query.</p>
  
  <p>What I have tried:</p>
  
  <pre><code>  return (from a in context.Tasks
                      select new TaskSearch
                      {
                          TaskID = a.TaskID,
                          TaskTypeName = Enum.GetName(typeof(TaskTypeEnum), a.TaskType)
                      }).ToList();
  </code></pre>
  
  <p>I'm using asp.net mvc.</p>
  
  <p><strong>Exception</strong>:
  An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code</p>
  
  <p>Additional information: LINQ to Entities does not recognize the method 'System.String GetName(System.Type, System.Object)' method, and this method cannot be translated into a store expression.</p>