Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Repositories.NHibernate/RepositoryBase.cs @ 257:730b80afa70d
Ticket #191: Perfil de Usuarios
author | juanjose.montesdeocaarbos |
---|---|
date | Wed, 19 Oct 2011 09:19:20 -0300 |
parents | 70c5cab59054 |
children |
rev | line source |
---|---|
144
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
1 using System; |
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
2 using AltNetHispano.Agendas.Domain; |
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
3 using NHibernate; |
63 | 4 |
5 namespace AltNetHispano.Agendas.Repositories.NHibernate | |
6 { | |
144
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
7 public class RepositoryBase<T> where T : Identificable |
63 | 8 { |
9 private readonly ISessionFactory _sessionFactory; | |
10 | |
246 | 11 protected RepositoryBase(ISessionFactory sessionFactory) |
63 | 12 { |
13 _sessionFactory = sessionFactory; | |
14 } | |
15 | |
16 protected ISession Session { get { return _sessionFactory.GetCurrentSession(); } } | |
17 | |
18 public void Save(T obj) | |
19 { | |
20 Session.Save(obj); | |
21 } | |
144
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
22 |
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
23 public T Get(Guid id) |
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
24 { |
246 | 25 return Session.Get<T>(id); |
26 //return Session.QueryOver<T>().Where(i => i.Id == id).SingleOrDefault(); | |
144
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
27 } |
a2b14da4902f
Alta y modificación de ponentes (personas)
Nelo@Guinea.neluz.int
parents:
63
diff
changeset
|
28 |
63 | 29 } |
30 } |