diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic')
2 files changed, 0 insertions, 121 deletions
diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic/GenericRepository_T_.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic/GenericRepository_T_.cs deleted file mode 100644 index f0c15d7..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic/GenericRepository_T_.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Gestor.Infrastructure.Entities.Generic;
-using NHibernate;
-using NHibernate.Linq;
-using NHibernate.Util;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-
-namespace Gestor.Infrastructure.Repository.Generic
-{
- public class GenericRepository<T> : IGenericRepository<T>
- where T : class
- {
- private readonly ISession _currentSession;
-
- public GenericRepository(ISession currentSession)
- {
- this._currentSession = currentSession;
- }
-
- public virtual void Add(T entity)
- {
- this._currentSession.Save(entity);
- }
-
- public void AddRange(IEnumerable<T> entities)
- {
- if (entities != null)
- {
- entities.ForEach<T>((T entity) => this._currentSession.Save(entity));
- }
- }
-
- public IQueryable<T> All()
- {
- return this._currentSession.Query<T>();
- }
-
- public void Delete(T entity)
- {
- this._currentSession.Delete(entity);
- }
-
- public void DeleteRange(IEnumerable<T> entities)
- {
- if (entities != null)
- {
- entities.ForEach<T>((T entity) => this._currentSession.Delete(entity));
- }
- }
-
- public void Evict<TEntity>(TEntity entity)
- where TEntity : EntityBase
- {
- this._currentSession.Evict(entity);
- }
-
- public T FindEntityById(long id)
- {
- return this._currentSession.Get<T>(id);
- }
-
- protected void Load<TEntity>(TEntity entity)
- where TEntity : EntityBase
- {
- EntityBase entityBase = entity;
- if (entityBase == null)
- {
- return;
- }
- this._currentSession.Load(entity, entityBase.Id);
- }
-
- public void Merge(T entity)
- {
- this._currentSession.Merge<T>(entity);
- }
-
- public virtual void SaveOrUpdate(T entity)
- {
- this._currentSession.SaveOrUpdate(entity);
- }
-
- public void Update(T entity)
- {
- this._currentSession.Update(entity);
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic/IGenericRepository_TEntity_.cs b/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic/IGenericRepository_TEntity_.cs deleted file mode 100644 index 3f43a5c..0000000 --- a/Gestor.Infrastructure/Gestor.Infrastructure.Repository.Generic/IGenericRepository_TEntity_.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Gestor.Infrastructure.Repository.Generic
-{
- public interface IGenericRepository<TEntity>
- where TEntity : class
- {
- void Add(TEntity entity);
-
- void AddRange(IEnumerable<TEntity> entities);
-
- IQueryable<TEntity> All();
-
- void Delete(TEntity entity);
-
- void DeleteRange(IEnumerable<TEntity> entities);
-
- void Evict<TE>(TE entity)
- where TE : EntityBase;
-
- TEntity FindEntityById(long id);
-
- void Merge(TEntity entity);
-
- void SaveOrUpdate(TEntity entity);
-
- void Update(TEntity entity);
- }
-}
\ No newline at end of file |