Class DbConnectionDataProvider
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.dll
Provides an abstract base implementation for data providers that use a database connection. Implements IDataProvider, ICanHandleUsedIdentifiers, ISerializable, IDisposable, and ISupportsLogger.
[Serializable]
public abstract class DbConnectionDataProvider : IDataProvider, ICanHandleUsedIdentifiers, ISerializable, IDisposable, ISupportsLogger
- Inheritance
-
DbConnectionDataProvider
- Implements
- Derived
- Inherited Members
Constructors
DbConnectionDataProvider()
Initializes a new instance of the DbConnectionDataProvider class. Subscribes to the native aggregate function name event.
protected DbConnectionDataProvider()
DbConnectionDataProvider(SerializationInfo, StreamingContext)
Initializes a new instance of the DbConnectionDataProvider class from serialized data.
protected DbConnectionDataProvider(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoThe SerializationInfo that holds the serialized object data.
contextStreamingContextThe contextual information about the source or destination.
Fields
PassedTables
Stores the names of tables that have already been processed along with a flag indicating whether their addition should be suppressed.
protected Dictionary<string, bool> PassedTables
Field Value
Properties
CancelBeforeClose
Gets or sets a value indicating whether the data provider should cancel operations before closing.
public bool CancelBeforeClose { get; set; }
Property Value
Connection
Gets or sets the database connection used by the data provider.
protected IDbConnection Connection { get; set; }
Property Value
Initialized
Gets or sets a value indicating whether the data provider has been initialized.
When set to true, the InitializationCompleted event is raised.
protected bool Initialized { get; set; }
Property Value
Logger
Gets the logger associated with the data provider.
protected ILlLogger Logger { get; }
Property Value
MinimalSelect
Gets or sets a value indicating whether a minimal select statement should be used.
public bool MinimalSelect { get; set; }
Property Value
Provider
Gets the underlying DbCommandSetDataProvider instance. Initializes a new instance if it has not been created yet.
protected DbCommandSetDataProvider Provider { get; }
Property Value
Support1to1Sortings
Gets or sets a value indicating whether fields from 1:1 relations are made available. Requires Provider.UseJoinsForParentRow to be true.
public bool Support1to1Sortings { get; set; }
Property Value
SupportGetParentRow
Gets or sets a value indicating whether getting the parent row is supported.
public bool SupportGetParentRow { get; set; }
Property Value
SupportSorting
Gets or sets a value indicating whether sorting is supported.
public bool SupportSorting { get; set; }
Property Value
SupportsAdvancedFiltering
Gets or sets a value indicating whether advanced filtering is supported by the data provider.
public abstract bool SupportsAdvancedFiltering { get; set; }
Property Value
SupportsAnyBaseTable
Gets a value indicating whether the provider supports any base table.
public bool SupportsAnyBaseTable { get; }
Property Value
Methods
AddCommand(IDbCommand, string)
Adds a database command for the specified table.
protected void AddCommand(IDbCommand command, string tableName)
Parameters
commandIDbCommandThe database command to add.
tableNamestringThe name of the table for which the command applies.
AddCommand(IDbCommand, string, string, string)
Adds a database command for the specified table using custom delimiter formats for identifiers and parameters.
protected void AddCommand(IDbCommand command, string tableName, string identifierDelimiterFormat, string parameterMarkerFormat)
Parameters
commandIDbCommandThe database command to add.
tableNamestringThe name of the table for which the command applies.
identifierDelimiterFormatstringThe format string used to delimit identifiers.
parameterMarkerFormatstringThe format string used for parameter markers.
AddRelation(string, string, string, string, string)
Adds a relation between two tables without specifying schemas.
protected void AddRelation(string relationName, string parentTableName, string childTableName, string parentColumnName, string childColumnName)
Parameters
relationNamestringThe name of the relation.
parentTableNamestringThe name of the parent table.
childTableNamestringThe name of the child table.
parentColumnNamestringThe column name in the parent table.
childColumnNamestringThe column name in the child table.
AddRelation(string, string, string, string, string, string, string)
Adds a relation between two tables with specified schemas.
protected void AddRelation(string relationName, string parentTableName, string childTableName, string parentColumnName, string childColumnName, string parentTableSchema, string childTableSchema)
Parameters
relationNamestringThe name of the relation.
parentTableNamestringThe name of the parent table.
childTableNamestringThe name of the child table.
parentColumnNamestringThe column name in the parent table.
childColumnNamestringThe column name in the child table.
parentTableSchemastringThe schema of the parent table.
childTableSchemastringThe schema of the child table.
Dispose()
Releases all resources used by the DbConnectionDataProvider. Calls the virtual Dispose(bool) method and suppresses finalization.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the DbConnectionDataProvider and, optionally, releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrueto release both managed and unmanaged resources;falseto release only unmanaged resources.
~DbConnectionDataProvider()
Finalizes an instance of the DbConnectionDataProvider class. Releases unmanaged resources before the instance is reclaimed by garbage collection.
protected ~DbConnectionDataProvider()
GetNativeAggregateFunctionName(NativeAggregateFunction)
Gets the native aggregate function name for the given aggregate function instance.
Override this method to return null if the function is not supported by the data provider.
protected virtual string GetNativeAggregateFunctionName(NativeAggregateFunction functionInstance)
Parameters
functionInstanceNativeAggregateFunctionThe aggregate function for which to retrieve the native name.
Returns
- string
The native aggregate function name as a string; by default, the function name is returned in upper case.
Init()
When implemented in a derived class, initializes the data provider.
protected abstract void Init()
OnAddDbCommand(object, AddDbCommandEventArgs)
Raises the AddDbCommand event.
protected virtual void OnAddDbCommand(object sender, AddDbCommandEventArgs e)
Parameters
senderobjectThe source of the event.
eAddDbCommandEventArgsA AddDbCommandEventArgs that contains the event data.
OnDbConnectionDataProviderInitialized(DbConnectionDataProviderInitializedEventArgs)
Raises the InitializationCompleted event.
protected virtual void OnDbConnectionDataProviderInitialized(DbConnectionDataProviderInitializedEventArgs e)
Parameters
eDbConnectionDataProviderInitializedEventArgsA DbConnectionDataProviderInitializedEventArgs that contains the event data.
OnExecuteDbCommand(object, ExecuteDbCommandEventArgs)
Raises the ExecuteDbCommand event.
protected virtual void OnExecuteDbCommand(object sender, ExecuteDbCommandEventArgs e)
Parameters
senderobjectThe source of the event.
eExecuteDbCommandEventArgsA ExecuteDbCommandEventArgs that contains the event data.
OnTranslateFilterSyntax(object, TranslateFilterSyntaxEventArgs)
Raises the TranslateFilterSyntax event.
protected virtual void OnTranslateFilterSyntax(object sender, TranslateFilterSyntaxEventArgs e)
Parameters
senderobjectThe source of the event.
eTranslateFilterSyntaxEventArgsA TranslateFilterSyntaxEventArgs that contains the event data.
SetLogger(ILlLogger, bool)
Sets the logger to be used by the data provider.
public void SetLogger(ILlLogger logger, bool overrideExisting)
Parameters
loggerILlLoggerThe logger instance to use.
overrideExistingbooltrueto override any existing logger; otherwise,false.
SuppressAddTableOrRelation(string, string)
Determines whether to suppress the addition of a table or its relations. Checks if the table has already been processed, and if not, raises the DefineTable event.
protected bool SuppressAddTableOrRelation(string tableName, string schema)
Parameters
Returns
- bool
trueif the table addition should be suppressed; otherwise,false.
Events
AddDbCommand
Occurs for each created IDbCommand object. A separate command is created per table.
public event EventHandler<AddDbCommandEventArgs> AddDbCommand
Event Type
DefineTable
Occurs before adding a new table or its relations. Subscribers can cancel the addition by setting Suppress to true.
public event EventHandler<DefineTableEventArgs> DefineTable
Event Type
ExecuteDbCommand
Occurs when a database command is about to be executed.
public event EventHandler<ExecuteDbCommandEventArgs> ExecuteDbCommand
Event Type
InitializationCompleted
Occurs after the tables and relations of the database have been analyzed and registered.
public event DbConnectionDataProviderInitializedHandler InitializationCompleted
Event Type
TranslateFilterSyntax
Occurs when the filter syntax translation is required.
public event EventHandler<TranslateFilterSyntaxEventArgs> TranslateFilterSyntax