queryover and (x like 'a' or y like 'a')

前端 未结 3 792
离开以前
离开以前 2020-12-04 16:16

Hi Is there any elegant way of combining \'like\' and \'or\' when i\'m using queryover API? for \'like\' there is something like:

 query.WhereRestrictionOn(         


        
3条回答
  •  感动是毒
    2020-12-04 17:11

    Another version of this, which depending on taste, you may like, is as follows:

    query.Where(Restrictions.Disjunction()
             .Add(Restrictions.On(e => e.Code).IsLike(codePart))
             .Add(Restrictions.On(e => e.Description).IsLike(codePart)));
    

提交回复
热议问题