title: Issue Retrieving a Screenshot from a database
body: <p>I've got a bunch of screenshots and some screenshot meta data I'm trying to display in an ASP.NET MVC 3 web application, I'm trying to retrieve the data from my databse but I get this error:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.Drawing.Image
    ByteArrayToImage(Byte[])' method, and this method cannot be translated
    into a store expression.</p>
  </blockquote>
  
  <p>Here's my code:</p>
  
  <pre><code>    var screenshotData = (from screenshots in db.screenshots
                                where screenshots.projects_ID == projectID
                                select new ImageInformation
                                {
                                    ID = screenshots.id,
                                    Language = screenshots.language,
                                    Screenshot = Utility.ByteArrayToImage(screenshots.screen_shot),
                                    ProjectID = screenshots.projects_ID
                                });
  
      foreach (ImageInformation info in screenshotData)
      {
          this.Add(info);
      }
  </code></pre>
  
  <p>ImageInformation is just a simple class that contains the defintion the information stored (ID, Language, Screenshot, ProjectID).</p>
  
  <p>Here's my ByteArrayToImage function:</p>
  
  <pre><code>public static Image ByteArrayToImage(byte[] byteArrayIn)
  {
      using (MemoryStream ms = new MemoryStream(byteArrayIn))
      {
          Image returnImage = Image.FromStream(ms);
          return returnImage;
      }
  } 
  </code></pre>
  
  <p>Can anybody tell me why I receive this error when this code runs?</p>
  
  <p>Thanks.</p>