Project: DddOrm
The solution shows how to implement a simple Domain Model using the Domain Driven Development approach.
The organization of the solution:

The domain class diagram:

Here the test that implements a use case:
[TestClass]
public class ContentTest
{
private NhibernateMediaUnitOfWorkDataSessionFactory mediaUnitOfWorkDataSessionFactory;
[TestInitialize]
public void Initiliaze()
{
mediaUnitOfWorkDataSessionFactory = new NhibernateMediaUnitOfWorkDataSessionFactory();
CreatePortalAndCategories();
}
[TestMethod]
public void AddContentWithCategoriesToPortal()
{
using (var uow = mediaUnitOfWorkDataSessionFactory.CreateUnitOfWork())
{
var portal = uow.PortalRepository.ByName("Wine");
var categoryList =
uow
.CategoryRepository
.CreateIfNotPresent(".NET/C#", ".NET/VB.NET");
portal.AddContent(ContentFactory.Create("Home", "Home description", categoryList));
uow.PortalRepository.Update(portal);
uow.Commit();
}
using (var uow = mediaUnitOfWorkDataSessionFactory.CreateUnitOfWork())
{
uow
.PortalRepository
.ByName("Wine")
.ContentList
.Should().Not.Be.Null();
}
}
private void CreatePortalAndCategories()
{
using (var uow = mediaUnitOfWorkDataSessionFactory.CreateUnitOfWork())
{
var portal = PortalFactory.CreatePortalByName("Wine");
uow.PortalRepository.Add(portal);
uow.Commit();
}
using (var uow = mediaUnitOfWorkDataSessionFactory.CreateUnitOfWork())
{
uow.CategoryRepository.CreateIfNotPresent(".NET/C#", ".NET/VB.NET");
uow.Commit();
}
}
}