ComponentOne Data Source for Entity Framework
Design-Time Features / Using C1DataSource in MVVM with other MVVM framework
In This Topic
    Using C1DataSource in MVVM with other MVVM framework
    In This Topic

    C1DataSource can be used to build Model-View-View-Model (MVVM) applications with any other MVVM frameworks.

    C1DataSource offers several features to make your MVVM development easier:  

    To demonstrate these important points, we provide a sample based on the code from the well-known article by Josh Smith, one of the authors of MVVM, "WPF Apps With The Model-View-ViewModel Design Pattern" (http://msdn.microsoft.com/en-us/magazine/dd419663.aspx).

    Please refer to the pre-installed product samples through the following path:

    Documents\ComponentOne Samples\WinForms

    Essentially all the files in our modified sample are the same as the originals (bar a few cosmetic changes) except one (ViewModels\OrdersViewModel.cs).   

    In this file, we build the view model class the C1DataSource way, using live views. You can see how many re-shaping functions are applied to model data to construct a view model, all done exclusively through LINQ. This made it easy and required little code. The best part is that it synchronizes automatically with model data when data in either of the two layers is changed - no synchronization code was necessary.

    The fact that we only changed the way that the view model classes themselves were created (they are still derived from the original base class 'ViewModelBase') and made no other changes to the framework code that Josh Smith had employed in his original sample should serve as an example that C1DataSource is entirely compatible with other frameworks. You can continue to use your preferred frameworks when working with MVVM, but now you have an additional tool to make your MVVM development even easier.