Class DataConnector
Provides the ability to load and save data from a data source.
public abstract class DataConnector : IDisposable
- Inheritance
-
DataConnector
- Implements
- Derived
- Inherited Members
Constructors
DataConnector(XmlNode)
Initializes a new instance of the DataConnector class.
public DataConnector(XmlNode node)
Parameters
nodeXmlNodeAn XML node containing the definition of the source.
DataConnector(string, bool)
Initializes a new instance of the DataConnector class.
public DataConnector(string name, bool readOnly)
Parameters
namestringThe name of the source.
readOnlyboolSets the value of the IsReadOnly property.
Properties
Id
Gets or sets the unique ID of the source.
public Guid Id { get; }
Property Value
- Guid
The unique ID of the source.
IsReadOnly
Gets or sets a value indicating whether this instance is read-only.
public bool IsReadOnly { get; protected set; }
Property Value
- bool
trueif this instance is read-only; otherwise,false.
Name
Gets or sets the name of the source.
public string Name { get; set; }
Property Value
- string
The name of the source.
Exceptions
- ArgumentException
If
valueisnullor empty or contains a '.' character.
XmlIdentifier
Gets the unique identifier for serialization and deserialization purposes as well as factory creation.
public abstract string XmlIdentifier { get; }
Property Value
Methods
Dispose()
Clean up any resources being used.
public void Dispose()
Dispose(bool)
Clean up any resources being used.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue if managed resources should be disposed; otherwise, false.
GetXMLNode(XmlNode)
Gets an XML node containing the definition of this source.
public XmlNode GetXMLNode(XmlNode parent)
Parameters
parentXmlNodeThe parent XML node.
Returns
- XmlNode
An XML node containing the definition of this source.
GetXMLNodeDerived(XmlNode)
Add DataSource specific information from derived classes to the node
protected abstract void GetXMLNodeDerived(XmlNode node)
Parameters
nodeXmlNodeThe node to which to add information of derived DataSources.
LoadColumns(out ColumnCollection)
Loads the data columns from the source.
public void LoadColumns(out ColumnCollection columns)
Parameters
columnsColumnCollectionWhen this method returns, contains the loaded columns. If loading the columns fails, the data source will return the last loaded columns.
Remarks
Calls LoadColumnsImpl(out ColumnCollection) to perform the actual operation.
The default implementation of this method calls LoadData(out ColumnCollection, out RowCollection) and just returns the loaded columns. Inheriting classes should override this method if the can provide a more efficient way to just load the data columns.
LoadColumnsImpl(out ColumnCollection)
If implemented by an inheriting class, loads the data columns from the source.
protected virtual void LoadColumnsImpl(out ColumnCollection columns)
Parameters
columnsColumnCollectionThe loaded columns.
Remarks
The default implementation of this method calls LoadDataImpl(out ColumnCollection, out RowCollection) and just returns the loaded columns. Inheriting classes should override this method if the can provide a more efficient way to just load the data columns.
LoadColumnsImpl(out ColumnCollection, out int)
If implemented by an inheriting class, loads the data columns from the source and the number of rows in the data source.
protected virtual void LoadColumnsImpl(out ColumnCollection columns, out int rowCount)
Parameters
columnsColumnCollectionThe loaded columns.
rowCountintThe number of rows.
Remarks
The default implementation of this method calls LoadDataImpl(out ColumnCollection, out RowCollection) and just returns the loaded columns and number of loaded rows. Inheriting classes should override this method if the can provide a more efficient way to just load the data columns.
LoadData(out ColumnCollection, out RowCollection)
Loads the data from the source.
public void LoadData(out ColumnCollection columns, out RowCollection rows)
Parameters
columnsColumnCollectionThe loaded columns.
rowsRowCollectionThe loaded rows.
Remarks
Calls LoadDataImpl(out ColumnCollection, out RowCollection) to perform the actual operation.
LoadDataImpl(out ColumnCollection, out RowCollection)
If implemented by an inheriting class, loads the data from the source.
protected abstract void LoadDataImpl(out ColumnCollection columns, out RowCollection rows)
Parameters
columnsColumnCollectionThe loaded columns.
rowsRowCollectionThe loaded rows.
Remarks
If implemented by an inheriting class, this method anew loads all data from the data source.
StoreData(ColumnCollection, RowCollection)
Stores the data to the data source.
public void StoreData(ColumnCollection columns, RowCollection rows)
Parameters
columnsColumnCollectionThe columns to store.
rowsRowCollectionThe rows to store.
Remarks
Calls StoreDataImpl(ColumnCollection, RowCollection) to perform the actual operation.
StoreDataImpl(ColumnCollection, RowCollection)
If implemented by an inheriting class, stores the data to the data source.
protected abstract void StoreDataImpl(ColumnCollection columns, RowCollection rows)
Parameters
columnsColumnCollectionThe columns to store.
rowsRowCollectionThe rows to store.
Remarks
If implemented by an inheriting class, this method anew stores all data to the data source.