protected override void RemoveItem(int index) { var item = this[index]; ItemDeleting?.Invoke(this, new ItemDeletingEventArgs <TItem>(index, item)); base.RemoveItem(index); }
public virtual void Delete <TEntity>(IEnumerable <TEntity> collection) where TEntity : class, new() { foreach (var entity in collection) { DataContext.Set <TEntity>().Remove(entity); ItemDeleting?.Invoke(entity); } }
public virtual void DeleteOne <TEntity>(params object[] keys) where TEntity : class, new() { var value = CreateKeyEntity <TEntity>(keys); var entry = GetEntryByKey(value); entry.State = EntityState.Deleted; ItemDeleting?.Invoke(value); }