Class DataProviderCollection
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.dll
Represents a collection of data providers that can be treated as a single data provider. In addition to exposing the tables and relations of its contained data providers, it supports cross-data provider relations, parameter binding, and handling of used identifiers.
public sealed class DataProviderCollection : IDataProvider, ICanHandleUsedIdentifiers, ICollection<IDataProvider>, IEnumerable<IDataProvider>, IEnumerable, ISupplyBaseTables, ICanHandleUsedRelations, ICrossRelationProvider, IRequireCollectedReportParameters
- Inheritance
-
DataProviderCollection
- Implements
- Inherited Members
Examples
// Create two separate datasets
DataSet ds1 = CreateDataSet();
DataSet ds2 = CreateOtherDataSet();
// Combine the data from ds1 and ds2 into one data source
DataProviderCollection providerCollection = new DataProviderCollection();
providerCollection.Add(new AdoDataProvider(ds1));
providerCollection.Add(new AdoDataProvider(ds2));
// Assign the combined data to the ListLabel class
LL.DataSource = providerCollection;
Remarks
The DataProviderCollection implements several interfaces including IDataProvider, ICanHandleUsedIdentifiers, ICollection<T>, ISupplyBaseTables, ICanHandleUsedRelations, ICrossRelationProvider, combit.Reporting.DataProviders.ISupportsParameters, and IRequireCollectedReportParameters.
It aggregates tables and relations from its child providers. When duplicate table or relation names are encountered, only one instance is returned. Cross-data provider relations can be added via the AddCrossProviderRelation(string, IDataProvider, string, string, IDataProvider, string, string) method.
Constructors
DataProviderCollection()
Initializes a new instance of the DataProviderCollection class.
public DataProviderCollection()
Properties
Count
Gets the number of data providers contained in the collection.
public int Count { get; }
Property Value
IsReadOnly
Gets a value indicating whether the collection is read-only.
public bool IsReadOnly { get; }
Property Value
Methods
Add(IDataProvider)
Adds the specified data provider to the collection.
public void Add(IDataProvider item)
Parameters
itemIDataProviderThe data provider to add.
AddCrossProviderRelation(string, IDataProvider, string, string, IDataProvider, string, string)
Creates a virtual 1:n relation between two tables from this collection of data providers. The tables may belong to different data providers or to the same data provider.
public void AddCrossProviderRelation(string relationName, IDataProvider parentProvider, string parentTableName, string parentColumnName, IDataProvider childProvider, string childTableName, string childColumnName)
Parameters
relationNamestringThe unique name for the cross-data provider relation.
parentProviderIDataProviderThe data provider containing the parent (primary key) table.
parentTableNamestringThe name of the parent table.
parentColumnNamestringThe name of the parent table's column.
childProviderIDataProviderThe data provider containing the child (foreign key) table.
childTableNamestringThe name of the child table.
childColumnNamestringThe name of the child table's column.
Exceptions
- ArgumentException
Thrown if either
parentProviderorchildProviderare not contained in this collection, or when the child table does not support filtering.
Clear()
Removes all data providers from the collection.
public void Clear()
Contains(IDataProvider)
Determines whether the collection contains the specified data provider.
public bool Contains(IDataProvider item)
Parameters
itemIDataProviderThe data provider to locate.
Returns
- bool
trueif the data provider is found; otherwise,false.
CopyTo(IDataProvider[], int)
Copies the elements of the collection to an array, starting at a particular array index.
public void CopyTo(IDataProvider[] array, int arrayIndex)
Parameters
arrayIDataProvider[]The destination array.
arrayIndexintThe zero-based index at which copying begins.
GetEnumerator()
Returns an enumerator that iterates through the collection of data providers.
public IEnumerator<IDataProvider> GetEnumerator()
Returns
- IEnumerator<IDataProvider>
An enumerator for the data providers.
Remove(IDataProvider)
Removes the first occurrence of a specific data provider from the collection.
public bool Remove(IDataProvider item)
Parameters
itemIDataProviderThe data provider to remove.
Returns
- bool
trueif the data provider was successfully removed; otherwise,false.
ReportParametersCollected(Dictionary<string, object>)
Reports the collected parameter values to all child data providers that require them.
public void ReportParametersCollected(Dictionary<string, object> paramValues)
Parameters
paramValuesDictionary<string, object>A dictionary of parameter names and their corresponding values.