LINQ to Entities does not recognize the method ... method, and this method cannot be translated into a store expression.
<p>MVC 5, C# - 
I am creating a view model based upon different sets of data in my database. I have the following code to create the View Model.</p>

<pre><code>    public ActionResult Register_step6()
    {
        CoreGeneral cg = new CoreGeneral();

        var model = (from p in db.WorkPointRoles
                     select new RegisterEmployee_Step6Model()

                     {
                         Role = p.Role,
                         Selected = false,
                         RoleDescription = cg.GetRoleDescription(p.Id)
                     });

        return View(model);

    }
</code></pre>

<p>I receive the following error message :</p>

<blockquote>
  <p>LINQ to Entities does not recognize the method 'System.String
  GetRoleDescription(Int32)' method, and this method cannot be
  translated into a store expression.</p>
</blockquote>

<p>I understand that the message has something to do with the Entities not recognising my GetRoleDescription code because it is placed in the select statement - (I've porbably worded my understanding incorrectly).. anyway, how do I solve the problem, where can I put the GetRoleDescription so that it runs on every record returned?</p>

<p>I hope this makes sense to someone! Apologies for the poorly worded question. Thanks in advance!</p>