Still new to NHibernate. I'm using NHibernate 2.1.2 and the Linq provider.
I am wondering where I should put my business rule logic. For example, I have an entity called Service with DateTime property. In my web app, I only ever want to display/work with services whose DataTime is less than 4 weeks away. Where should I put that rule?
I started out building a ServiceRepository with a IEnumerable GetServices() method that encapsulated that logic, thinking "Oh! Everytime I need a service, I'll go to that method!"
Of course, problems show up when I need to load child objects of my services. I don't want a lot of permutations of the same method in my repository when querying my database. In fact I really don't want to use repositories at all, because I'm trying very hard to heed Ayende's Advice, since I'm still new to NHibernate.
I like the idea of having objects that specify what I need from the database, and I could encapsulate the business rule within it. The linq part of it is what is throwing me off, I think.