Share via


Add Functionality to Respond to Notifications from the Data Provider (Compact 7)

3/12/2014

When a data provider’s data changes, it must notify applications to which it is connected. Then, those applications can update their data source objects and display the new data in the UI.

To connect to a data provider, you must add functionality to your application that responds to notifications and obtains new data after each notification is received.

For example, you can add the functionality to an event handler for a UI element such as a Check for Updated Data button.

The functionality that responds to notifications and updates data must implement thread safety. Otherwise, a user updating the data by using the UI and a data provider updating the data might occur at the same time, which can compromise data integrity. For example, you can use the XRAutoCriticalSection class to create a critical section object that blocks access to the thread until the updated data is obtained.

Note

Different data providers have different implementations of sending notifications to applications.

For example, for a CEMAPI email message application, you can implement functionality that registers for and responds to notifications by creating a MAPI advise sink object and obtaining event data from a NOTIFICATION programming element. For more information, see Event Notification in MAPI, Handling Notifications, and Handling an Incoming Message.

After you add functionality to respond to notifications and obtain new data from the data provider, you must then verify that the data is in the correct format before you add it to a TPropertyBag<Derived> object.

See Also

Concepts

Connect to a Data Provider