c# 4.0 - NHibernate queryover how to apply date isbetween without including the from and todate -


i trying write nhibernate queryover select records has been deleted between 2 dates. using isbetween().and(). how write if dont want include both fromdate , todate?

here query:

public ienumerable<deletedrecord> search(     datetime deletedfrom,     datetime deletedto     ) {     deletedrecord delalias = null;     var query = session.queryover(() => delalias);     query.where(() => delalias.deleteddate.isbetween(deletedfrom).and(deletedto));      return query.future<deletedrecord>(); } 

can me how achieve can bring records after deletedfrom date , before deletedto date?

thanks

just construct date in 2 steps:

var query = session.queryover(() => delalias);  if(youneedfromdate) //first step    query = query.where(() => delalias.deleteddate >= deletedfrom); if(youneedtodate) //second step    query = query.where(() => delalias.deleteddate <= deletedto); 

youneedfromdate , youneedtodate bool variables can pass function or different condition upon logic.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -