Table of Contents

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

info SerializationInfo

The SerializationInfo that holds the serialized object data.

context StreamingContext

The 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

Dictionary<string, bool>

Properties

CancelBeforeClose

Gets or sets a value indicating whether the data provider should cancel operations before closing.

public bool CancelBeforeClose { get; set; }

Property Value

bool

Connection

Gets or sets the database connection used by the data provider.

protected IDbConnection Connection { get; set; }

Property Value

IDbConnection

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

bool

Logger

Gets the logger associated with the data provider.

protected ILlLogger Logger { get; }

Property Value

ILlLogger

MinimalSelect

Gets or sets a value indicating whether a minimal select statement should be used.

public bool MinimalSelect { get; set; }

Property Value

bool

Provider

Gets the underlying DbCommandSetDataProvider instance. Initializes a new instance if it has not been created yet.

protected DbCommandSetDataProvider Provider { get; }

Property Value

DbCommandSetDataProvider

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

bool

SupportGetParentRow

Gets or sets a value indicating whether getting the parent row is supported.

public bool SupportGetParentRow { get; set; }

Property Value

bool

SupportSorting

Gets or sets a value indicating whether sorting is supported.

public bool SupportSorting { get; set; }

Property Value

bool

SupportsAdvancedFiltering

Gets or sets a value indicating whether advanced filtering is supported by the data provider.

public abstract bool SupportsAdvancedFiltering { get; set; }

Property Value

bool

SupportsAnyBaseTable

Gets a value indicating whether the provider supports any base table.

public bool SupportsAnyBaseTable { get; }

Property Value

bool

Methods

AddCommand(IDbCommand, string)

Adds a database command for the specified table.

protected void AddCommand(IDbCommand command, string tableName)

Parameters

command IDbCommand

The database command to add.

tableName string

The 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

command IDbCommand

The database command to add.

tableName string

The name of the table for which the command applies.

identifierDelimiterFormat string

The format string used to delimit identifiers.

parameterMarkerFormat string

The 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

relationName string

The name of the relation.

parentTableName string

The name of the parent table.

childTableName string

The name of the child table.

parentColumnName string

The column name in the parent table.

childColumnName string

The 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

relationName string

The name of the relation.

parentTableName string

The name of the parent table.

childTableName string

The name of the child table.

parentColumnName string

The column name in the parent table.

childColumnName string

The column name in the child table.

parentTableSchema string

The schema of the parent table.

childTableSchema string

The 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

disposing bool

true to release both managed and unmanaged resources; false to 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

functionInstance NativeAggregateFunction

The 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

sender object

The source of the event.

e AddDbCommandEventArgs

A AddDbCommandEventArgs that contains the event data.

OnDbConnectionDataProviderInitialized(DbConnectionDataProviderInitializedEventArgs)

Raises the InitializationCompleted event.

protected virtual void OnDbConnectionDataProviderInitialized(DbConnectionDataProviderInitializedEventArgs e)

Parameters

e DbConnectionDataProviderInitializedEventArgs

A DbConnectionDataProviderInitializedEventArgs that contains the event data.

OnExecuteDbCommand(object, ExecuteDbCommandEventArgs)

Raises the ExecuteDbCommand event.

protected virtual void OnExecuteDbCommand(object sender, ExecuteDbCommandEventArgs e)

Parameters

sender object

The source of the event.

e ExecuteDbCommandEventArgs

A ExecuteDbCommandEventArgs that contains the event data.

OnTranslateFilterSyntax(object, TranslateFilterSyntaxEventArgs)

Raises the TranslateFilterSyntax event.

protected virtual void OnTranslateFilterSyntax(object sender, TranslateFilterSyntaxEventArgs e)

Parameters

sender object

The source of the event.

e TranslateFilterSyntaxEventArgs

A 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

logger ILlLogger

The logger instance to use.

overrideExisting bool

true to 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

tableName string

The name of the table.

schema string

The schema of the table.

Returns

bool

true if 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

EventHandler<AddDbCommandEventArgs>

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

EventHandler<DefineTableEventArgs>

ExecuteDbCommand

Occurs when a database command is about to be executed.

public event EventHandler<ExecuteDbCommandEventArgs> ExecuteDbCommand

Event Type

EventHandler<ExecuteDbCommandEventArgs>

InitializationCompleted

Occurs after the tables and relations of the database have been analyzed and registered.

public event DbConnectionDataProviderInitializedHandler InitializationCompleted

Event Type

DbConnectionDataProviderInitializedHandler

TranslateFilterSyntax

Occurs when the filter syntax translation is required.

public event EventHandler<TranslateFilterSyntaxEventArgs> TranslateFilterSyntax

Event Type

EventHandler<TranslateFilterSyntaxEventArgs>