Esempio n. 1
0
        protected MvcApplication()
        {
            // This configures the unit or work to be on a per request basis.

            BeginRequest += delegate
            {
                UnitOfWork = new UnitOfWork(_sessionFactory);
            };
            EndRequest += delegate
            {
                if (UnitOfWork != null)
                {
                    // Notice that we are rolling back unless
                    //    an explicit call to commit was made elsewhere.
                    //
                    UnitOfWork.Dispose();
                }
            };
        }