Nhibernate Linq query to QueryOver

前端 未结 1 1641
一个人的身影
一个人的身影 2021-01-23 22:07

I have the following piece of code:

1: ids = GetAnArrayOfIds();

2: jobEntities = jobEntities.Where(j => j.Locations.Select(l => l.Id).Any(ids.Contains));
         


        
1条回答
  •  臣服心动
    2021-01-23 22:27

    var results = session.QueryOver()
        .JoinQueryOver(u => u.Locations)
        .Where(loc => loc.Id.IsIn(ids))
        .TransformUsing(Transformers.DistinctRootEntity)
        .List();
    

    Hope this helps

    0 讨论(0)
提交回复
热议问题