1
我用string.join但不工作。如何字符串数组转换字符串值,在linq线?
IQueryable<CandidateVModel> list = cRepository.Table.Where(x=> !x.CFDemand.Any(y => y.AStatusId == (int) TStatus.SWork)).Select(x => new CandidateVModel
{
...
Email = x.Email,
Tags = x.Tags,
Comments= string.Join(", ",x.CFDemand.SelectMany(y=>y.JInterview.SelectMany(z=>z.JInterviewer.SelectMany(t=>t.JInterviewerFeedback.Select(a=>a.Comments))))),
Ref= x.Ref
}).AsExpandable().Where(p);
错误:消息=“LINQ实体无法识别方法 'System.String加入(System.String,System.Collections.Generic.IEnumerable`1 [System.String])' 方法,和该方法不能转换成商店表达式。“
这需要认真重新思考....之后的第一选择很多更不用说接下来的3本我失去了一个代码味道对我来说...... –
没有与'String.Join'等价的SQL,因此EF无法将其转换为SQL。如果您可以提供有关数据模型的更多详细信息,则可以通过拉取两个集合并将它们加入到Linq-to-Objects中来获得帮助。 –
引用下面的链接: - http://stackoverflow.com/questions/4095658/how-do-i-concatenate-strings-in-entity-framework-query – Sahi