public CollectionByKeyExecutor(TrackCollectionByKey <TKey, TValue> target, CollectionByKeyCommand <TKey, TValue> command) : base(target, command) { if (command.Action == CollectionByKeyChanged.Remove || command.Action == CollectionByKeyChanged.Update) { OldValue = target[command.Key]; } }
public static CollectionByKeyExecutor <TKey, TValue> Update(TrackCollectionByKey <TKey, TValue> target, TKey key, TValue newItem) { return(new CollectionByKeyExecutor <TKey, TValue>(target, new CollectionByKeyCommand <TKey, TValue>(CollectionByKeyChanged.Update, key, newItem))); }
public static CollectionByKeyExecutor <TKey, TValue> Remove(TrackCollectionByKey <TKey, TValue> target, TKey key) { return(new CollectionByKeyExecutor <TKey, TValue>(target, new CollectionByKeyCommand <TKey, TValue>(CollectionByKeyChanged.Remove, key, default))); }
public static CollectionByKeyExecutor <TKey, TValue> Insert(TrackCollectionByKey <TKey, TValue> target, TKey key, TValue newValue) { return(new CollectionByKeyExecutor <TKey, TValue>(target, new CollectionByKeyCommand <TKey, TValue>(CollectionByKeyChanged.Insert, key, newValue))); }