Table of Contents

Class DataSourceProvider

Namespace
Alternet.UI
Assembly
Alternet.UI.dll

Common base class and contract for data source providers. A DataProvider in Alternet UI is the factory that executes some query to produce a single object or a list of objects that can be used as sources for Alternet UI data bindings. It is a convenience wrapper around existing data model, it does not replace any data model. A data provider does not attempt to condense the complexity and versatility of a data model like ADO into one single object with a few properties.

public abstract class DataSourceProvider : INotifyPropertyChanged, ISupportInitialize
Inheritance
DataSourceProvider
Implements
Derived

Remarks

DataSourceProvider is an abstract class and cannot directly be used as a data provider. Use one of the derived concrete provider, e.g. XmlDataProvider, ObjectDataProvider. The DataProvider aware of Alternet UI's threading and dispatcher model. The data provider assumes the thread at creation time to be the UI thread. Events will get marshalled from a worker thread to the app's UI thread.

Constructors

DataSourceProvider()

constructor captures the Dispatcher associated with the current thread

Properties

Data

Get the underlying data object. This is the resulting data source the data provider

Error

Return the error of the last query operation. To indicate there was no error, it will return null

IsInitialLoadEnabled

Set IsInitialLoadEnabled = false to prevent or delay the automatic loading of data.

IsRefreshDeferred

IsRefreshDeferred returns true if there is still an outstanding DeferRefresh in use. To get the best use out of refresh deferral, derived classes should try not to call Refresh when IsRefreshDeferred is true.

Methods

BeginInit()

Initialization of this element is about to begin; no implicit Refresh occurs until the matched EndInit is called

BeginQuery()

Overridden by concrete data provider class. the base class will call this method when InitialLoad or Refresh has been called and will delay this call if refresh is deferred ot initial load is disabled.

DeferRefresh()

Enter a Defer Cycle. Defer cycles are used to coalesce property changes, any automatic Refresh is delayed until the Defer Cycle is exited.

EndInit()

Initialization of this element has completed; this causes a Refresh if no other deferred refresh is outstanding

InitialLoad()

Start the initial query to the underlying data model. The result will be returned on the Data property. This method is typically called by the binding engine when dependent data bindings are activated. Set IsInitialLoadEnabled = false to prevent or delay the automatic loading of data.

OnPropertyChanged(PropertyChangedEventArgs)

Raises a PropertyChanged event (per INotifyPropertyChanged).

OnQueryFinished(object)

A concrete data provider will call this method to indicate that a query has finished.

OnQueryFinished(object, Exception, DispatcherOperationCallback, object)

A concrete data provider will call this method to indicate that a query has finished.

Refresh()

Initiates a Refresh Operation to the underlying data model. The result will be returned on the Data property.

Events

DataChanged

Raise this event when a new data object becomes available on the Data property.

PropertyChanged

PropertyChanged event (per INotifyPropertyChanged).