/// <summary> /// Gets or sets the <see cref="TEntity" /> with the specified index. /// </summary> public TEntity this[int index] { get { ///// // Struct type always returns an instance. ///// IMutableIdKey match = _tracker.ElementAt(index); return(Entity.Get <TEntity>(match.Key)); } set { Precheck( ); ///// // Struct type always returns an instance. ///// IMutableIdKey match = _tracker.ElementAt(index); _tracker.Remove(match); if (value != null) { _tracker.Add((( IEntityInternal )value).MutableId); } } }
protected override async Task ExecuteAsync(IKey key, CancellationToken cancellationToken) { Movie model = collection.FindByKey(key); if (model != null && await navigator.ConfirmAsync($"Delete movie '{model.Name}'?")) { changeTracker.Remove(collection, model); } }
/// <summary> /// Removes the specified item. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public bool Remove(TEntity item) { if (item == null) { return(false); } Precheck( ); IMutableIdKey[] matches = _tracker.Where(pair => pair.Key == item.Id).ToArray( ); return(matches.Aggregate(false, (current, match) => current & _tracker.Remove(match))); }