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