Radical Documentation
View on GitHub
Primary version
Primary version
  • Home
  • Presentation
    • AbstractViewModel
    • Conventions
      • Bootstrap Conventions
      • Runtime Conventions
      • Conventions override
    • Commands and DelegateCommand
    • IViewResolver
      • Default view behaviors
      • view life cycle events
        • Callback expectations
        • notify messages
    • Message broker MVVM built-in messages
    • Application boot process
      • Application configuration
      • Application shutdown
      • Singleton applications
    • AbstractMementoViewModel
      • Simple ViewModel graphs
      • Collections and complex ViewModel graphs
    • Validation and Validation Services
    • Resources
      • Services as resources
      • ViewModels as resources
  • UI Composition
    • UI Composition
      • Region content lifecycle
      • TabControl region
      • Create a custom region
  • Concepts
    • Inversion of Control
      • Third party DI containers
    • Entities
      • Property System
    • Messaging and Message Broker
      • POCO messages
      • Standalone message handlers
    • Observers
      • PropertyObserver
      • MementoObserver
      • BrokerObserver
  • Memento
    • Change Tracking Service
      • MementoEntity and MementoEntityCollection
      • Handling change tracking:
        • Simple model
        • Collections
        • Complex objects graph
      • Atomic operations
      • Change Tracking Service API
      • Property Metadata for the ChangeTrackingService
      • Handling collection sync
      • Property State
  • Behaviors
    • DataGrid Behaviors
    • Password
    • Generic routed event handler to command behavior
    • Overlay adorner
      • Busy status manager
    • TextBox behaviors:
      • Command
      • Auto select
      • DisableUndoManager (.Net 3.5 only)
  • Markup Extensions
    • Editor binding
    • Auto Command binding
  • How to
    • Get the view of a given view model
    • Bi-directional communication between different windows/views
    • Handle the busy status during async/long running operations
    • Implement a customer improvement program
    • Manage focus
    • Create a splash screen
    • Access view model after view is closed
    • Intercept ViewModels before they are used
  • Upgrade guides
    • Radical Presentation 1.x to Radical 2.x for .NET Core
    • Radical 2.0.0 to Radical 2.1.0
Powered by GitBook
On this page
  1. Memento

Change Tracking Service

Dealing with objects graphs can be complex and can get more complex as the graph evolves or gets bigger.

What we want to achieve in our software solutions is something like the following sample code:

var person = new Person();
person.FirstName = "first name value";
person.LastName = "last name value";

var address =  new Address();
address.Street = "street address value";

person.Addresses.Add( address );

Given the above code snippet we have basically 2 requirements:

  • Know the state of the graph:

    • Is it changed?

    • Is there something that can be undone (backward changes)?

    • Is there something that can be redone (forward changes)?

  • Change the state of the graph:

    • Accept all changes at once;

    • Reject all changes at once;

    • Undo a single change;

    • Redo a single change;

But there is more, from the user perspective a single change can be reflected in more than one action, and thus change, in the code itself:

var order = new Order();
order.Customer = ... //reference to a customer object;

// --> begin of "atomic" operation
var item = new OrderItem();
item.ItemId =  123;
item.Quantity = 2;
order.Items.Add( item );
// --> end of "atomic" operation

In the above sample creating the order, setting property values, and adding it to the items collection, from the user perspective, are a single operation that matches the add to cart operation. In such a scenario an undo operation should rollback the entire set of changes to the new order item and the last add operation.

PreviousBrokerObserverNextMementoEntity and MementoEntityCollection

Last updated 3 years ago

Given these requirements the next step is to rely on something that allows us to transparently handle the entire change tracking process, the first step is to understand what are.

MementoEntity and MementoEntityCollection