What is the best way to implement dynamic, complex filter queries in ServiceStack OrmLite? -


class productfilter{     public string name { get; set; }     .     .     . } 

i have product search form, result of form productfilter. in productfilter class, among others there property stores name of product search for. best way generate dynamic query, add condition on product name, if productfilter.name not null , not empty? first thought create sqlexpression object , based on condition add or not additional conditions it, sqlexpression cannot instantiazed.

you may use generic sql code params , check, whether query param null like

select * mytable (name = @name or @name null) 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -