I think this is more of a design question than an nHydrate question but I want to see if there's an nHydrate solution before I start doing crazy things.
Let's say, for sake of example, that I have an Order class, and it has a custom boolean method called "IsOverdue" that implements some overly complicated business logic to determine if an Order is overdue. I use this method to flag Orders
in red when viewing in a datagrid.
Now let's say I have 10 million orders and I want to run a query to get all the overdue ones. I already have my business logic in one place, and I'd like to keep it in one place. I'm OK moving it, but I'd like to keep just one copy.
My first instinct is to do OrderCollection q = new OrderCollection.RunSelect(x => x.IsOverdue==true)
Of course this doesn't work, nor should it because SQL has no idea what I'm talking about.
What's my next move? I've so far avoided writing any views or stored procedures, but I feel like now's the time to cave.