I am very new to Nhibernate, so this may sound silly.
I have a function which receives parameters based on what I need to make queries:
Public List<Data> GetResultData(SearchParams[] searchparams) {}
In this case, SearchParams
is my class which has few properties say ID
and Name
which will be used to query.
So here are two challenges I am facing:
I need to make a query based only on the property of
SearchParams
which are filed. Say one object ofsearchParams
array is like this:ID, NAME "34", ""
As we can see the
NAME
doesn't have value. So my query needs to be like:select * from DB where ID ="34".
The query has to be created at runtime on the basis of values available. If both properties are available, then it will be
AND
of both.Since the input is an array of search parameters, there will be as many queries as the number of objects. I am trying to think of a way in which I can make a UNION of all these queries and fire them in one go.
Thoughts?