DataSource for Entity Framework in WPF
C1DataSource Introduction / Unified Data Context
In This Topic
    Unified Data Context
    In This Topic

    In both the Entity Framework and WCF RIA Services, the developer is solely responsible for managing the contexts (sessions), creating them explicitly and often creating individual ones for each form in an application. Objects retrieved by one context bear no relation to those retrieved by another, even if they are essentially similar. This can create severe problems when different forms (or even different tabs on a tab control in a single form) need to interact. Up until now, the traditional way to solve these problems has been to repeatedly save data back to the underlying database and continually refresh the GUI to reflect any changes that have occurred. The result - a lot of repeated code and degradation in overall application performance brought about through repeated trips to the database server.

    DataSource for Entity Framework provides a better solution by combining a unified data context and intelligent client cache. This means that an application needs only one data context which is available to all forms and controls therein. The intelligent client cache keeps track of all changes made to the context’s objects, in essence enabling client-side transactional functionality, removing the need to continually save and refresh views, so application performance is improved and code simplified. Local data cache also enables client-side queries with full LINQ capabilities (filtering, sorting, grouping, and more) which would otherwise be impossible.

    Note:  DataSource for Entity Framework supports both kinds of Entity Framework contexts, the newer DbContext (the default context in Visual Studio) and the legacy ObjectContext.