Class DbCommandSetDataProvider
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.dll
Provides a data provider implementation based on a set of database commands.
public sealed class DbCommandSetDataProvider : IDataProvider, ICanHandleUsedIdentifiers, IDisposable, ISupportsLogger
- Inheritance
-
DbCommandSetDataProvider
- Implements
- Inherited Members
Examples
The following example demonstrates how to use the DbCommandSetDataProvider:
// Create OleDb commands for different tables.
OleDbCommand command = new OleDbCommand("Select * from [Customers]", conn);
OleDbCommand command2 = new OleDbCommand("Select * from [Orders]", conn);
// Create the command set data provider and add commands.
DbCommandSetDataProvider provider = new DbCommandSetDataProvider();
provider.AddCommand(command, "Customers");
provider.AddCommand(command2, "Orders");
// Define a relation between the "Customers" and "Orders" tables.
provider.AddRelation("Customers2Orders", "Customers", "Orders", "CustomerID", "CustomerID");
// Assign the provider as the data source for the reporting engine and design the report.
LL.DataSource = provider;
LL.Design();
Remarks
This provider supports caching of SQL queries for parent/child relations, parameter binding, custom filter translation, and logging of executed commands. It implements IDataProvider, ICanHandleUsedIdentifiers, IDisposable, ISupportsLogger, and combit.Reporting.DataProviders.ISupportsParameters. In addition, it supports advanced command cloning, connection cloning techniques, and custom field value converters.
Constructors
DbCommandSetDataProvider()
Initializes a new instance of the DbCommandSetDataProvider class with default settings.
public DbCommandSetDataProvider()
Properties
CaseSensitive
Gets or sets a value indicating whether table and column name comparisons are case-sensitive.
public bool CaseSensitive { get; set; }
Property Value
MinimalSelect
If disabled, List & Label avoids to parse or modify the SQL queries. Setting this option to false usually has a negative impact on the reporting performance, but may solve some issues when the optimizations of List&Label would lead to invalid SQL queries.
public bool MinimalSelect { get; set; }
Property Value
PrefixTableNameWithSchema
Gets or sets a value indicating whether to prefix table names with their schema.
public bool PrefixTableNameWithSchema { get; set; }
Property Value
Support1to1Sortings
Gets or sets a value indicating whether sorting by fields from 1:1 relations is supported. Requires UseJoinsForParentRow to be true.
public bool Support1to1Sortings { get; set; }
Property Value
SupportGetCount
Gets or sets a value indicating whether counting rows is supported.
public bool SupportGetCount { get; set; }
Property Value
SupportGetParentRow
Gets or sets a value indicating whether retrieving a 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
SupportsAnyBaseTable
Gets a value indicating whether the provider supports any base table. Always returns true.
public bool SupportsAnyBaseTable { get; }
Property Value
UseJoinsForParentRow
Gets or sets a value indicating whether 1:1 relations are queried using JOIN statements. When set to true (default), JOINs are used for improved performance. Set to false for very complex statements.
public bool UseJoinsForParentRow { get; set; }
Property Value
Methods
AddCommand(IDbCommand, string)
Overload of AddCommand that uses default identifier delimiters based on the command type.
public void AddCommand(IDbCommand command, string tableName)
Parameters
commandIDbCommandThe database command to add.
tableNamestringThe name for the resulting table.
AddCommand(IDbCommand, string, string, string)
Adds a database command to the provider, resulting in a new table definition in the Designer. This method parses the SQL command text, validates identifiers, and caches parameter formats.
public void AddCommand(IDbCommand command, string tableName, string identifierDelimiterFormat, string parameterMarkerFormat)
Parameters
commandIDbCommandThe database command to add.
tableNamestringThe name for the resulting table.
identifierDelimiterFormatstringThe format string to delimit table names in generated SQL queries (e.g. "[{0}]" for Access).
parameterMarkerFormatstringThe format string to format parameter names in generated SQL queries (e.g. "@{0}" for SQL Server).
Exceptions
- ArgumentException
Thrown if the command's connection is null or if a valid table name is not provided.
AddRelation(string, string, string, string, string)
Adds a relation between two tables.
public void AddRelation(string relationName, string parentTableName, string childTableName, string parentColumnName, string childColumnName)
Parameters
relationNamestringThe name for the relation. This may appear in the UI if multiple relations exist between the same two tables.
parentTableNamestringThe name of the parent table.
childTableNamestringThe name of the child table.
parentColumnNamestringThe parent column name. For multiple key fields, separate names with a tab character.
childColumnNamestringThe child column name. For multiple key fields, separate names with a tab character.
Dispose()
public void Dispose()
~DbCommandSetDataProvider()
protected ~DbCommandSetDataProvider()
Events
ExecuteDbCommand
Occurs when a database command is about to be executed. Subscribers can modify the command before execution.
public event EventHandler<ExecuteDbCommandEventArgs> ExecuteDbCommand
Event Type
TranslateFilterSyntax
Occurs when filter syntax translation is requested. Subscribers can override the default translation.
public event EventHandler<TranslateFilterSyntaxEventArgs> TranslateFilterSyntax