Esempio n. 1
0
        /// <summary>
        /// Creates and begins a new instance of an <see cref="NHibernateUnitOfWork"/> for the the specified session.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <returns>
        /// A new <see cref="NHibernateUnitOfWork"/>.
        /// </returns>
        public static NHibernateUnitOfWork Begin(ISession session)
        {
            var unitOfWork = new NHibernateUnitOfWork(session);
            unitOfWork.Begin();

            return unitOfWork;
        }
Esempio n. 2
0
        public void SetUp()
        {
            this.Session = this.SessionFactory.OpenSession();

            using (var tx = this.Session.BeginTransaction())
            {
                SessionFactoryFactory.BuildSchema(this.Session);

                tx.Commit();
            }

            this.UnitOfWork = new NHibernateUnitOfWork(this.Session);
            this.UnitOfWork.Begin();

            this.PerformSetUp();

            this.UnitOfWork.Commit(true);
        }