NHibernate removes DAL?

data-access-layer, nhibernate

Solution

You need a DAL, the question is what do you do in the DAL. In a .NET project with NHibernate, I use this organisation

- MyProject.Core.DomainModel : in this project only the .cs and mapping files (.hbm.xml)

- MyProject.Repo : in this classes you use NHibernate method like Get, Load, make query ....

- MyProject.Service : from these classes, I call the MyProject.Repo methods

- MuProject.UI : ASP.NET, ASP.NET MVC, Winforms .....

- MyProject.Service.Tests : all the unit test to test the service

I give you an example, I'd like get all active Employee and sort them.

in my UI, I call MyProject.Service.EmployeeService.GetActive(); in getGetActive, I call a function in PyProject.Repo to get active employee. When I have the result back (in the service method), I do an order with Linq and return the list ordered.

To resume, the Repo project, it's access DB via NHibernate and Service it's the business.

It's my opinion, it's like this I do it's may be not the best way, not the only way, but it's my way :)

Problem

Am I right that using NHibernate (or any other ORM) removes the necessity of DAL? Or not?

Original source