I need to build a dynamic query from a search form. I have been using
Linq for NH and it's been great when the queries are simple. I just
build the query for the passed parameters, like so:
public IList<Order> GetOrdersBy(int? customerId=null, int? carId=null,
string status=null)
{
var query = Session.Query<Order>();
if(customerId.HasValue)
query = query.Where(x => x.status == status);
...
...
}
Pretty simple since everything is on the same table.
Now I need to track the status everytime it changes so there is a new
table that looks like this:
OrderStatusLog
-----------------------
id int
orderId int
status varchar
createdate datetime
When someone searches for a status, I need to search against the MAX
status. When someone searches on a date range, I want to search
between min(createdate) and max(createdate). I tried to do this with
a GROUP BY in linq but I got a notimplemented. What is the best way
to do this? I was avoiding QueryOver and Criteria for much of this
because it always trips me up.
Any suggestions before I hack together an HQL string?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.