C# LINQ to实体无法识别方法';字符串ToString()';方法,而此方法无法转换为存储表达式

C# LINQ to实体无法识别方法';字符串ToString()';方法,而此方法无法转换为存储表达式,c#,asp.net-mvc,linq,entity-framework,C#,Asp.net Mvc,Linq,Entity Framework,我的asp.net mvc应用程序中有以下视图:- @model MvcApplication4.Models.ContactsDetails <h3>Select Contacts Detials</h3> <p class="dashboarder" style = "color:#5c87b2"><strong>@Model.Info.Count()</strong> Selected Customers Ac

我的asp.net mvc应用程序中有以下视图:-

 @model MvcApplication4.Models.ContactsDetails
     <h3>Select Contacts Detials</h3>
    <p class="dashboarder" style = "color:#5c87b2"><strong>@Model.Info.Count()</strong> Selected Customers Accounts.</p>
    @using (Html.BeginForm("Export", null))
    {
        Int32 c = -1;
        <table>
            <tr>
                <th>
                    Account Name @Html.CheckBox("IncludeAccountName", true)
                </th>
                <th>
                    Name @Html.CheckBox("IncludeName", true)
                </th>
然后使用以下存储库方法:-

public IEnumerable<AaaUserContactInfo> getcontactinfo(long[] id)
{
    var organizationNames = entities.SDOrganizations
                   .Where(org => id.Contains(org.ORG_ID))
                   .Select(org => org.NAME);


    var result = from userContactInfo in entities.AaaUserContactInfoes
                 join contactInfo in entities.AaaContactInfoes on userContactInfo.CONTACTINFO_ID equals contactInfo.CONTACTINFO_ID
                 where organizationNames.Contains(contactInfo.EMAILID.ToString())
                 select userContactInfo;
    return result;
关于以下代码:-

<strong>@Model.Info.Count()</strong>
@Model.Info.Count()
使用方法而不是
ToString
(无法转换为SQL):

如果
EMAILID
不是double或decimal,则只需将值强制转换为这些类型之一

LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
<strong>@Model.Info.Count()</strong>
where organizationNames.Contains(SqlFunctions.StringConvert(contactInfo.EMAILID))