Best approach to add a case in a column for nhibernate -
what best way add query projection in nhibernate?  case      when account.firstname = '' , account.lastname = ''          email.emailaddress     else account.firstname + ' ' + account.lastname end 
should this:
var accounts = session.queryover<account>()   .select(projections.conditional(restrictions.and(             restrictions.eq("firstname", ""),             restrictions.eq("lastname", "")),               projections.concat(p.lastname, ", ", p.firstname),               projections.property(t => t.emailaddress)))   .list(); 
Comments
Post a Comment