I favour having an IExtentService instead - something like
public interface IExtentService
{
IEnumerable<T> AllInstances<T>(ISession session);
}
The *only* reason I have this is so that when I am writing tests and
need data from the DB I can instead mock the IExtentService and return
an in-memory List<T> instead. The rest of the app then uses the
specification pattern like so
IEnumerable<Person> people = extentService.AllInstances<Person>();
people = new OldPeopleSpecification(people).Filter();
people = new MalePeopleSpecification(people).Filter();
etc
public class MalePeopleSpecification
{
readonly IEnumerable<Person> People;
public MalePeopleSpecification(IEnumerable<Person> people)
{
//check people not null
People = people;
}
public IEnumerable<Person> Filter()
{
return People.Where(p => p.Gender = Gender.Male);
}
}
Regards
Pete
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---