public BaseRepository(EntityFrameworkDbContext entityFrameworkDbContext) : base(entityFrameworkDbContext) { if (entityFrameworkDbContext == null) { throw new ArgumentNullException(nameof(entityFrameworkDbContext)); } _entityFrameworkDbContext = entityFrameworkDbContext; _set = _entityFrameworkDbContext.Set <TEntity>(); }
public bool DeleteByID(object id) { var model = _entityFrameworkDbContext.Set <TEntity>().Find(id); _entityFrameworkDbContext.Set <TEntity>().Remove(model); return(_entityFrameworkDbContext.SaveChanges() > 0); }