NHibernate with or without Repository
Posted
by Groo
on Stack Overflow
See other posts from Stack Overflow
or by Groo
Published on 2010-05-01T14:24:39Z
Indexed on
2010/05/01
14:38 UTC
Read the original article
Hit count: 341
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?
© Stack Overflow or respective owner