Created
May 7, 2014 08:00
-
-
Save jrgcubano/1a126a1ac7bea584c467 to your computer and use it in GitHub Desktop.
C# CrudRepository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class CrudRepository<TEntity>:CrudRepository<TEntity,Guid>,ICrudRepository<TEntity> | |
{ | |
} | |
public abstract class CrudRepository<TEntity,TId>: ICrudRepository<TEntity,TId> | |
{ | |
#region properties | |
public abstract IQueryable<TEntity> RepositoryQuery { get; } | |
#endregion | |
#region Implementation of IQueryable | |
protected Expression Expression | |
{ | |
get { return RepositoryQuery.Expression; } | |
} | |
protected Type ElementType | |
{ | |
get { return RepositoryQuery.ElementType; } | |
} | |
protected IQueryProvider Provider | |
{ | |
get { return RepositoryQuery.Provider; } | |
} | |
#endregion | |
#region IRepository<TEntity,TId> Members | |
public abstract TEntity Create(TEntity entity); | |
public abstract TEntity Update(TEntity entity); | |
public abstract TEntity Merge(TEntity entity); | |
public abstract TEntity Find(TId Id); | |
public abstract int Count(); | |
public abstract IList<TEntity> List(); | |
public abstract IList<TEntity> List(int StartIndex, int Length); | |
public abstract void Delete(TId Id); | |
public abstract void Delete(TEntity entity); | |
public abstract void Detach(TEntity entity); | |
public abstract void Attach(TEntity entity); | |
public abstract void Refresh(TEntity entity); | |
//public IEnumerable<TEntity> Query(ISpecification<TEntity> specification) | |
//{ | |
// return RepositoryQuery.Where(specification.Predicate).AsQueryable(); | |
//} | |
public abstract IList<TEntity> List(SearchParams searchParams); | |
#endregion | |
public abstract void DeleteAll(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment