public CollectionByKeyExecutor(CommandedCollectionByKey <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> Remove(CommandedCollectionByKey <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(CommandedCollectionByKey <TKey, TValue> target, TKey key, TValue newValue) { return(new CollectionByKeyExecutor <TKey, TValue>(target, new CollectionByKeyCommand <TKey, TValue>(CollectionByKeyChanged.Insert, key, newValue))); }