Hi there,
I'm using NHibernate, and have a one to may mapping set up. Let's call it Customer -> Orders This all works, and I can get all the orders for the customer.
Now, I'd like to filter these orders, let's say I just want orders between run time determined dates.
public class Customer
{
...
// mapped from NHibernate mapping file
public IList<Orders>Orders {get; set; }
// get a filtered list of orders
public IList<Orders>GetOrders(DateTime start, DateTime end) { ... }
...
}
So I could Enumerate over all of the orders and select the ones I want, but I'd like to defer the filtering off to the database as the number of orders could be very large.
The question is, can I do this in the mapping file with a filter? Or do I need to create a method on a repository to do this and access that method from my domain object?
Any other suggestions are also welcome....
Many thanks
RR