title: LINQ to Entities does not recognize the method 'Int32 ToInt32(System.Object)' method, and this method cannot be translated into a store expression
body: <p>Here's what I'm trying to do:</p>
  
  <pre><code>public List&lt;int&gt; GetRolesForAccountByEmail(string email)
  {
      var account = db.Accounts.SingleOrDefault(a =&gt; a.Email == email);
      if (account == null) return new List&lt;int&gt;();
  
      return db.AccountRoles.Where(a =&gt; a.AccountId == account.AccountId).Select(a =&gt; Convert.ToInt32(a.RoleId)).ToList();
  }
  </code></pre>
  
  <p>I had to convert to Int32 because I could not return a <code>List&lt;int?&gt;</code> when the method was to return a <code>List&lt;int&gt;</code>.</p>
  
  <p>Any suggestions on how to solve this simple problem?</p>