Skip to content

Instantly share code, notes, and snippets.

@mariobot
Created August 10, 2015 18:28
Show Gist options
  • Save mariobot/427b3aa1df3357784be7 to your computer and use it in GitHub Desktop.
Save mariobot/427b3aa1df3357784be7 to your computer and use it in GitHub Desktop.
GenericRepository
namespace CodedHomes.Data
{
public class GenericRepository<T> : IRepository<T> where T : class
{
protected DbSet<T> DBSet { get; set; }
protected DbContext Context { get; set; }
public GenericRepository(DbContext context)
{
if (context == null)
throw new ArgumentException("An argument of context its necesary.");
this.Context = context;
this.DBSet = this.Context.Set<T>();
}
public IQueryable<T> GetAll() {
throw new NotImplementedException();
}
public T GetById(int id)
{
throw new NotImplementedException();
}
public void Add(T entity) {
throw new NotImplementedException();
}
public void Update(T entity)
{
throw new NotImplementedException();
}
public void Delete(T entity)
{
throw new NotImplementedException();
}
public void Delete(int id)
{
throw new NotImplementedException();
}
public void Detach(T entity)
{
throw new NotImplementedException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment