NHibernate with or without Repository
- by Groo
There are several similar questions on this matter, by I still haven't found enough reasons to decide which way to go.
The real question is, is it reasonable to abstract the NHibernate using a Repository pattern, or not?
It seems that the only reason behind abstracting it is to leave yourself an option to replace NHibernate with a different ORM if needed. But creating repositories and abstracting queries seems like adding yet another layer, and doing much of the plumbing by hand.
One option is to use expose IQueryable<T> to the business layer and use LINQ, but from my experience LINQ support is still not fully implemented in NHibernate (queries simply don't always work as expected, and I hate spending time on debugging a framework).
Although referencing NHibernate in my business layer hurts my eyes, it is supposed to be an abstraction of data access by itself, right?
What are you opinions on this?