view Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/RequestEmulator.cs @ 275:bf993f99cee3

Ticket #123: Patrocinadores de las vans.
author juanjose.montesdeocaarbos
date Wed, 14 Dec 2011 08:15:44 -0300
parents 68b09c30b0d2
children
line wrap: on
line source

using System;
using NHibernate;
using NHibernate.Context;

namespace Agendas.Repositories.Tests.Infraestructure
{
	public class RequestEmulator : IDisposable
	{
		private readonly ISession _session;

		public RequestEmulator(ISessionFactory sessionFactory)
		{
			_session = sessionFactory.OpenSession();
			CurrentSessionContext.Bind(_session);
		}

		public void Dispose()
		{
			_session.Flush();
			_session.Close();
		}
	}
}