C# .NET MVC在计数()时返回错误
我有一个问题:C# .NET MVC在计数()时返回错误,c#,asp.net-mvc,C#,Asp.net Mvc,我有一个问题: foreach (var item in outcomeAreas) { var outcomeAreasCohorts = db.Cohorts .Join(db.OutcomeArea, c => c.ID, oa => oa.CohortID, (c, oa) => new { c = c, oa = oa }) .Where(oa => oa.oa.OutcomeType.Contains(item.SubC
foreach (var item in outcomeAreas)
{
var outcomeAreasCohorts = db.Cohorts
.Join(db.OutcomeArea, c => c.ID, oa => oa.CohortID, (c, oa) => new { c = c, oa = oa })
.Where(oa => oa.oa.OutcomeType.Contains(item.SubCategory.ToString()))
.Select(c => new { c.c.cohortID }).Distinct().ToList().Count();
allFilters.Add(new GetFilters { Category = item.Category, Identifier = item.Identifier, SubCategory = item.SubCategory, SubCategoryIdentifier = item.SubCategory.ToString().Replace(" ", "-"), TopLevel = "Key Cohort Outcomes", TotalNum = outcomeAreasCohorts.ToString() });
}
然而,这给我带来了一个错误
Values of type 'collection[Edm.String(Nullable=True,DefaultValue=,MaxLength=,Unicode=,FixedLength=)]' can not be converted to string.
我尝试搜索,但没有找到此错误。想法?尝试删除该实体并将其添加回edmx。通常有效。你是说把它从课堂上移除吗?明白了。谢谢