Created
February 9, 2012 20:17
-
-
Save dgomesbr/1782792 to your computer and use it in GitHub Desktop.
Implementação do repositório genérico
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using workshop_httpmodule; | |
namespace Workshop.Data.NHibernate | |
{ | |
public class GenericRepository<T> : IRepository<T> | |
{ | |
public T Save(T entity) | |
{ | |
NHibernateHttpModule.RecuperarSessao.Save(entity); | |
return entity; | |
} | |
public T Update(T entity) | |
{ | |
NHibernateHttpModule.RecuperarSessao.Update(entity); | |
return entity; | |
} | |
public void Delete(T entity) | |
{ | |
NHibernateHttpModule.RecuperarSessao.Delete(entity); | |
} | |
public T ById(int id) | |
{ | |
return NHibernateHttpModule.RecuperarSessao.Get<T>(id); | |
} | |
public IList<T> All() | |
{ | |
return NHibernateHttpModule.RecuperarSessao.CreateCriteria(typeof(T)).List<T>(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment