DoRefreshMergeIfNoChangesExist Extension Method

Overview

Refreshes the UI baseline from a server snapshot, but only when there are no pending local changes in the observable data set. If local changes exist, the underlying refresh strategy throws, preventing accidental loss of edits.

Declaration

/// <summary>
/// Refreshes the observable data set from a refreshed data set, but only when there are no pending local changes in the observable data set
/// </summary>
/// <param name="observableDataSet">Observable data set</param>
/// <param name="refreshedDataSet">Refreshed data set</param>
/// <param name="observableMergeOptions">Observable merge options</param>
public static void DoRefreshMergeIfNoChangesExist(this IObservableDataSet? observableDataSet, IDataSet refreshedDataSet, IObservableMergeOptions observableMergeOptions)

Namespace and Assembly

Namespace: PocoDataSet.ObservableExtensions
Assembly: PocoDataSet.ObservableExtensions.dll

Usage Example

// 1. Assuming observable data set is used for UI binding
IObservableDataSet boundObservableDataSet = new ObservableDataSet();

// The following line is a pseudo-code example of how UI can be bound to the observable data set.
// The actual binding code depends on the UI framework and is not part of POCO DataSet.
somePage.DataContext = boundObservableDataSet;

// 2. The UI decides to refresh itself from the server latest data
// Say, you got the response from the server as IDataSet into latestSnapshotFromServer variable:
IDataSet latestSnapshotFromServer = ...

// 3. Call DoRefreshMergeIfNoChangesExist method to refresh the UI with the latest snapshot from the server.
// If the user has no pending edits, the refresh applies.
// If pending edits exist, the refresh strategy throws to protect user changes.
IObservableMergeOptions options = new ObservableMergeOptions();
boundObservableDataSet.DoRefreshMergeIfNoChangesExist(latestSnapshotFromServer, options);

 

Table of Content POCO DataSet Observable Data Set Members

 


Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness or suitability of the information and are not responsible for any damages resulting from its use.