I am reading the official Your first NHibernate based application.
While the tutorial is good and easy to follow, I am wondering why the Repository pattern is used.
In the various
Remove methods in the
ProductRepository implementation, the code is nearly identical - they are all using transactions, and the difference is in the "meat" i.e. call
session.Save int the
session.Delete in the
(The page lacks HTML anchors, but you can search the page for the relevant code like
public void Remove,
public void Add)
That code just "feels wrong".
Why is the author using the Repository pattern - is it just for demonstration of using NHibernate or is that required or some other reason?
Ps. My background is from Ruby on Rails using ActiveRecord so I'm trying to make sense of how NHibernate works/is used.