I'm working on project that uses NHibernate 3, but the code is pretty messy. What I would like to do is:
- introduce testing code into project
- introduce Repository pattern - I did it in projects with Entity Framework 4, and I enjoyed it, especially opportunity to test queries regardless of storage used (I could mock the internal storage and inject in-memory implementation like List of objects)
- as currently DAO code works with CreateCriteria methods and creates queries that are NHibernate specific, it's impossible to replace NHibernate storage with another (or at least I don't know how to execute NHibernate.ICriteria on List instance. So I need a way to create queries that can be used regardless of storage implementation.
Is there any way to achieve it?