Optional interfaces, Idatasource, Idatasourcedefinition – Pitney Bowes MapXtreme User Manual

Page 502: Itablemodifyprocessor

Advertising
background image

Appendix D: Extensible Data Providers

Optional Interfaces

MapXtreme v7.1

509

Developer Guide

Optional Interfaces

The MapXtreme Extensible Data Provider model includes optional interfaces to provide more
capabilities when accessing data, including:

IDataSource

IDataSourceDefinition

ITableModifyProcessor

IDataSource

The IDataSource interface is used in Catalog.OpenTable to associate a new table with a specific
data source. This is optional as you can build a data provider without going through a data source.

A data source is instantiated when an ITableDefinition is being opened which contains an associated
IDataSourceDefinition or directly through Catalog.DataSources.OpenDataSource method. The
extracted IDataSourceDefinition is supplied to IDataProvider.OpenDataSource to connect to the
data source and return the associated IDataSource instance.

IDataSourceDefinition

A DataSourceDefinition is only necessary when you are using a data source to access data. It
includes the information you expect the user to supply in order to be able to instantiate a data
source. If you are not using a data source, you only need to provide a Tabledefinition in order to
open a table.

In the process of the table being opened, the IDataSourceDefinition is extracted from the
DataSourceDefinition property and passed into OpenDataSource(IDataSourceDefinition,
CustomProperties) to try and establish a connection to the data source.

When implementing a DataSourceDefinition, you should provide a meaningful override
implementation of the System.Object.Equals(object) method.

ITableModifyProcessor

The table metadata indicates whether Insert, Update, or Delete operations are supported. If any of
these are true, then you must supply an implementation for the ITableModifyProcessor.
Implementations for the specific insert, update, and delete methods must be provided according to
the corresponding individual metadata properties. Some data providers may only support insert
operations for example. The ASCII data provider supplied with MapXtreme is an example of a data
provider that only supports insert operations and not update or delete operations.

Note that the ITable interface also includes a property named ReadOnly. This property is an extra
level of control through which you can indicate if the table is read only. Even if your provider supplies
a fully implemented modify processor, a specific table may be read only for other reasons such as
insufficient access permissions or the data files are on read only media. Your data provider can
check for these up front and flag the whole table as ReadOnly or through the individual table
metadata properties.

Advertising