C# 如何将此字符串与LINQ组合
我有一个LINQ查询。它必须将匹配字符串与“组合为单个字符串值。我用我的模型尝试了下面的代码。但显示: LINQ to实体无法识别方法“System.String” 聚合[String](System.Linq.IQueryableC# 如何将此字符串与LINQ组合,c#,entity-framework,C#,Entity Framework,我有一个LINQ查询。它必须将匹配字符串与“组合为单个字符串值。我用我的模型尝试了下面的代码。但显示: LINQ to实体无法识别方法“System.String” 聚合[String](System.Linq.IQueryable1[System.String], System.Linq.Expressions.Expression1[System.Func`3[System.String,System.String,System.String]] 方法,而此方法无法转换为存储表达式 请建议我
1[System.String],
System.Linq.Expressions.Expression
1[System.Func`3[System.String,System.String,System.String]]
方法,而此方法无法转换为存储表达式
请建议我如何编写查询以将字符串集合并为单个字符串
代码
BTags = Db.BibContents.Where(x => x.BibId == q.BibId && x.TagNo == "245")
.Select(x => x.NormValue)
.Aggregate((s, x) => s + " " + x).FirstOrDefault()
谢谢为什么不使用like:
为什么不使用像:
我在我的模型里面用,我在我的模型里面用。
string str = string.Join(" ", Db.BibContents
.Where(x => x.BibId == q.BibId && x.TagNo == "245")
.Select(x => x.NormValue));