Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created April 15, 2018 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/5e92884472ec579d8bc27dc785b7ceea to your computer and use it in GitHub Desktop.
Save NMZivkovic/5e92884472ec579d8bc27dc785b7ceea to your computer and use it in GitHub Desktop.
public class Repository<TEntity> : IReporitory<TEntity> where TEntity : class
{
protected readonly DbContext Context;
protected readonly DbSet<TEntity> Entities;
public Repository(DbContext context)
{
Context = context;
Entities = Context.Set<TEntity>();
}
public void Add(TEntity entity)
{
Entities.Add(entity);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment