NHibernate with IQueryOver - create where-condition with subquery and or condition -


when do

acc accountalias = null; var subquery = queryover.of<temp>()                .where(x=>x.isaccepted==null)                .and(x=>x.account.id==accountalias.id);  var results = session.queryover<acc>(()=>accountalias)               .where(x=>x.user.id==65)               .withsubquery.whereexists(subquery); 

this create fallowing sql:

select * accounts a.user_id=65 , exists (     select t.account_id     temporary_accounts t     t.isaccepted null , t.account_id=a.account_id) 

how can add or condition, nhibernate generate fallowing sql:

select * accounts a.user_id=65  , (a.amount = 100 or exists (     select t.account_id     temporary_accounts t     t.isaccepted null , t.account_id=a.account_id)) 

not tested tihs may trick

acc accountalias = null; var subquery = queryover.of<temp>()                .where(x => x.isaccepted == null)                .and(x => x.account.id == accountalias.id);  var results = session.queryover<acc>(()=>accountalias)                   .where(restrictions.disjunction()                      .add(subqueries.whereexists(subquery))                      .add(x => x.amount == 100))                   .and(x => x.user.id = 65)                   .list(); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -