annotate 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
rev   line source
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
1 using System;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
2 using NHibernate;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
3 using NHibernate.Context;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
4
222
68b09c30b0d2 Separando los test de persistencia en un proyecto aparte
nelopauselli
parents: 137
diff changeset
5 namespace Agendas.Repositories.Tests.Infraestructure
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
6 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
7 public class RequestEmulator : IDisposable
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
8 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
9 private readonly ISession _session;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
10
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
11 public RequestEmulator(ISessionFactory sessionFactory)
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
12 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
13 _session = sessionFactory.OpenSession();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
14 CurrentSessionContext.Bind(_session);
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
15 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
16
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
17 public void Dispose()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
18 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
19 _session.Flush();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
20 _session.Close();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
21 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
22 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
23 }