Nhibernate Linq query to QueryOver

前端 未结 1 1635
一个人的身影
一个人的身影 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<Job>()
        .JoinQueryOver<Location>(u => u.Locations)
        .Where(loc => loc.Id.IsIn(ids))
        .TransformUsing(Transformers.DistinctRootEntity)
        .List();
    

    Hope this helps

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