Beispiel #1
0
 public T retornarPorId(int id)
 {
     using (ISession session = FluentiSessionFactori.OpenSession())
     {
         return(session.Get <T>(id));
     }
 }
Beispiel #2
0
 public IList <T> consultar()
 {
     using (ISession session = FluentiSessionFactori.OpenSession())
     {
         return((from e in session.Query <T>() select e).ToList());
     }
 }
Beispiel #3
0
 public void eliminar(T entidade)
 {
     using (ISession session = FluentiSessionFactori.OpenSession())
     {
         using (ITransaction transaccion = session.BeginTransaction())
         {
             try
             {
                 session.Delete(entidade);
                 transaccion.Commit();
             }
             catch (Exception ex)
             {
                 if (!transaccion.WasCommitted)
                 {
                     transaccion.Rollback();
                 }
                 throw new Exception("Error al Eliminar la entidad " + ex.Message);
             }
         }
     }
 }