我有以下代码:
1: ids = GetAnArrayOfIds();
2: jobEntities = jobEntities.Where(j => j.Locations.Select(l => l.Id).Any(ids.Contains));
如何使用QueryOver编写2?
谢谢,
答案 0 :(得分:5)
var results = session.QueryOver<Job>()
.JoinQueryOver<Location>(u => u.Locations)
.Where(loc => loc.Id.IsIn(ids))
.TransformUsing(Transformers.DistinctRootEntity)
.List();
希望这有帮助