Exemplo n.º 1
0
 public TEntity GetById <TEntity>(Guid id) where TEntity : BaseEntity
 {
     using (ISession session = FluentNHibertnateSession.OpenSession())
     {
         return(session.Get <TEntity>(id));
     }
 }
Exemplo n.º 2
0
 public List <TEntity> GetAll <TEntity>() where TEntity : BaseEntity
 {
     using (ISession session = FluentNHibertnateSession.OpenSession())
     {
         return(session.Query <TEntity>().ToList());
     }
 }
Exemplo n.º 3
0
 public List <TEntity> Filter <TEntity>(Func <TEntity, bool> condition) where TEntity : BaseEntity
 {
     using (ISession session = FluentNHibertnateSession.OpenSession())
     {
         return(session.Query <TEntity>()
                .Where(condition)
                .ToList());
     }
 }
Exemplo n.º 4
0
 public void AddOrUpdate <TEntity>(TEntity entity) where TEntity : BaseEntity
 {
     using (ISession session = FluentNHibertnateSession.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.SaveOrUpdate(entity);
             transaction.Commit();
         }
     }
 }