I have a Visual Studio Solution with 3 projects:
- MyWebSite (A)
- BusinessModel (B)
- Persistence (C)
Persistence
, project C
, depends on NHibernate
and contains all of the repository interfaces, Hibernate
implementations of those repositories, and the classes which map to the DB tables.
BusinessModel
, project B
, depends on C
and contains all of the service classes and classes representing the business domain entities. These services use the repositories to retrieve data and then transform that data into business representations the surface in their own interfaces.
MyWebSite
, project A
, depends on A
and contains all of the MVC classes/files. The MVC controllers here use the service class from B
to do any business logic functions. There is no knowledge from this level that project B
uses project C
's repositories to perform its operations.
In a perfect world, I would imagine that project A
should reference B
which references C
which references NHibernate
. This does not seem to be true. I find that project A
needs a reference to B
and C
and NHibernate
! I don't like the idea of my web application needing knowledge of my back-end architecture and I especially don't want it aware of the fact that I am using NHibernate
as my ORM.
Is there a way to tell these projects to utilize transitive dependencies when resolving their references?
My project is .NET 4 in Visual Studio 2010, if that info makes any difference.
EDIT:
I found this SO answer to a related question which explains these references are only needed if project C
's classes are surfaced from project B
. I have been very determined to not have any leaks between layers and I know Hibernate
classes are only used in C
so maybe I just don't understand correctly...