Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Implementação do repositório genérico
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
You can’t perform that action at this time.