public override void OnTransactionApplied(OnTransactionAppliedArgs args) { // There are multiple ways we can react to the change. // We could subscribe to the update, we could check the state of the object, // we could validate either the data or the version of the object in the snapshot, // or we can just wait for global updates of the state. // Here we pick the last option. base.OnTransactionApplied(args); switch (testStage) { case TestStage.WaitingForObjectCreation: if (!args.insertedKeys.IsEmpty) { testStage = TestStage.WaitingForModificationByOtherClient; } break; case TestStage.WaitingForModificationByOtherClient: if (!args.updatedKeys.IsEmpty) { testStage = TestStage.Done; } break; } }
virtual public void OnTransactionApplied(OnTransactionAppliedArgs args) { // Ignoring the returned values for this example. foreach (UpdatedKey affectedKey in args.insertedKeys) { TryInsertObject(args.snapshotAfter.GetKey(affectedKey.Key)); } foreach (UpdatedKey affectedKey in args.updatedKeys) { TryUpdateObject(args.snapshotAfter, affectedKey); } foreach (UpdatedKey key in args.removedKeys) { TryRemoveObject(key.Key); } }