我收到以下 linq 查询错误:
LINQ to Entities 无法识别方法 'System.Collections.Generic.List 1[System.Char] ToList[Char](System.Collections.Generic.IEnumerable
1[System.Char])' 方法,并且此方法无法转换为存储表达式。
var result =
(
from citation in Db.Citation
where citation.IsActive == true
select new CitationViewModel
{
CitationID = citation.CitationID,
CitationTitle = citation.CitationTitle,
DocType = citation.DocType,
DateOfPub = citation.DateOfPub,
authors = citation.citation_Authors.Where(c => c.CitationID == citation.CitationID).SelectMany(b => b.Author.AuthorName).ToList(),
}
);
这是我的视图模型:
public class CitationViewModel
{
public int CitationID { get; set; }
public string CitationTitle { get; set; }
public IList<char> authors { get; set; }
}
提前致谢。