请有人帮忙解决此问题。我试图从索引返回一个列表,其中id匹配给定列表中的任何id。我试过了:
var members = session.Query<MembersNameIdIndex.Result, MembersNameIdIndex>()
.Where(x => list.Any(y => y == x.Id))
.AsProjection<MembersNameIdIndex.Result>()
.ToList();
和
var members = from m in session.Query<MembersNameIdIndex.Result, MembersNameIdIndex>()
where list.Any(y => y == m.Id)
select m;
var projection = members.AsProjection<MembersNameIdIndex.Result>()
.ToList();
和
var members = from m in session.Query<MembersNameIdIndex.Result, MembersNameIdIndex>()
where list.Contains(m.Id)
select m;
var projection = members.AsProjection<MembersNameIdIndex.Result>()
.ToList();
错误始终相同:Expression type not supported: System.Linq.Expressions.TypedParameterExpression
(对于最后2个,它在投影部分失败。)
答案 0 :(得分:1)
这应该有效:
var members = from m in session.Query<MembersNameIdIndex.Result, MembersNameIdIndex>()
where m.Id.In(list)
select m;
var projection = members.AsProjection<MembersNameIdIndex.Result>()
.ToList();