Created
February 2, 2012 11:27
-
-
Save hvitorino/1723020 to your computer and use it in GitHub Desktop.
repositorio
This file contains hidden or 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
public class Repositorio<T> : IRepositorio<T> where T : Entidade | |
{ | |
public void Altera(T entidade) | |
{ | |
NhSession.Merge(entidade); | |
NhSession.Flush(); | |
} | |
public T Inclui(T entidade) | |
{ | |
NhSession.SaveOrUpdate(entidade); | |
NhSession.Flush(); | |
return entidade; | |
} | |
public void Exclui(long id) | |
{ | |
var entidade = Procura(id); | |
Exclui(entidade); | |
} | |
public void Exclui(T entidade) | |
{ | |
NhSession.Delete(entidade); | |
NhSession.Flush(); | |
} | |
public void Descarta() | |
{ | |
NhSession.Clear(); | |
NhSession.Transaction.Rollback(); | |
} | |
} | |
public class SeuTipoLinduxuController | |
{ | |
public CentroController(IRepositorio<SeuTipoLinduxu> repositorio) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment