public T RetornaId(int id)
 {
     using (ISession session = FluentySessionFactory.AbrirSession())
     {
         return(session.Get <T>(id));
     }
 }
 public IList <T> Consultar()
 {
     using (ISession session = FluentySessionFactory.AbrirSession())
     {
         return((from e in session.Query <T>() select e).ToList());
     }
 }
 public void Alterar(T entidade)
 {
     using (ISession session = FluentySessionFactory.AbrirSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 session.Update(entidade);
                 transaction.Commit();
             }
             catch (System.Exception ex)
             {
                 if (!transaction.WasCommitted)
                 {
                     transaction.Rollback();
                 }
                 throw new System.Exception("Erro ao Alterar entidade: " + ex.Message);
             }
         }
     }
 }