I had written a Query in NHibernate as below:
var queryResult = CurrentSession.QueryOver()
.Where(r => r.StatusId == 1)
.JoinQueryOver(a => a.ActorList)
.Where(s=>s.IsActor==1)
.List()
.Distinct()
.ToList();
I am trying to retrieve only Where(s=>s.IsActor==1)
, But It Is Getting Records
Where(s=>s.IsActor==0)
also...
How can I get only IsActor==1
records?
Thanks in Advance
You need to specify a predicate in the join, so that it is applied to the join not the top where:
(will look something like
...LEFT JOIN actor on actor.Id = p.ActorId AND IsActor = 1
)