Click here to Skip to main content
15,886,362 members
Articles / Database Development / SQL Server / SQL Server 2008

Implementing Logging & Transaction for NHibernate through Configuration Files using Aspect Oriented Programming via Unity

Rate me:
Please Sign up or sign in to vote.
4.67/5 (9 votes)
5 Jan 2009CPOL4 min read 62.5K   338   30  
Applying AOP using Unity on NHibernate
using NHibernate;
using UnityGettingStarted;

namespace Infrastructure.Repositories
{
    public class DepartmentRepository : RepositoryBase
    {
        public DepartmentRepository(ISession session) : base(session)
        {
        }

        public Department GetDepartment(int DepartmentID)
        {
            return (Department) Session.Load(typeof (Department), DepartmentID);
        }

        public void SaveDepartment(Department department)
        {                        
            Session.SaveOrUpdate("Department", department);            
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Ardent Collaborations
India India

Comments and Discussions