Beispiel #1
0
 public TEntity GetById <TEntity>(Guid id) where TEntity : BaseEntity
 {
     using (ISession session = FluentNHibertnateSession.OpenSession())
     {
         return(session.Get <TEntity>(id));
     }
 }
Beispiel #2
0
 public List <TEntity> GetAll <TEntity>() where TEntity : BaseEntity
 {
     using (ISession session = FluentNHibertnateSession.OpenSession())
     {
         return(session.Query <TEntity>().ToList());
     }
 }
Beispiel #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());
     }
 }
Beispiel #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();
         }
     }
 }