Julien Leicher 7a9aefbefc tiny-refactors (#27)
add UnitWorkBehavior and some files moving
add Docker stuff to prepare heroku deployment
rename (Up/Down)vote
add sample for msbuild tasks
2020-12-17 12:01:11 +01:00

23 lines
522 B
C#

using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace HN.Infrastructure.Repositories
{
public abstract class Repository<TEntity> where TEntity : class
{
private readonly HNDbContext _context;
protected readonly DbSet<TEntity> Entries;
protected Repository(HNDbContext context)
{
_context = context;
Entries = _context.Set<TEntity>();
}
protected async Task AddAsync(params TEntity[] entities)
{
await Entries.AddRangeAsync(entities);
}
}
}