List<Post> list =
(
from c in db.TitleComments
join t in db.Titles on c.TitleId equals t.Id
join u in db.Users on c.UserId equals u.Id
where t.Id == _titleId && c.Date > time
orderby c.Date descending
select new Post { Username = u.Username, PostingDate = c.Date.ToString(), Data = c.Comment }
).ToList();
上述代码在将日期转换为字符串时引发异常,PostingDate = c.Date.ToString()。有什么办法可以解决这个问题吗?
异常错误: {"LINQ to Entities不识别'System.String ToString()'方法,该方法无法转换为存储表达式。"}