Class NpgsqlConnectionDataProvider
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.NpgsqlConnectionDataProvider.dll
Provider for Npgsql Postgres connection, see http://npgsql.projects.postgresql.org/
[Serializable]
public sealed class NpgsqlConnectionDataProvider : DbConnectionDataProvider, IDataProvider, ICanHandleUsedIdentifiers, IDisposable, ISupportsLogger, ISerializable
- Inheritance
-
NpgsqlConnectionDataProvider
- Implements
- Inherited Members
Examples
The following example demonstrates how to use the NpgsqlConnectionDataProvider to export a report to PDF:
// Initialize the NpgsqlConnectionDataProvider with your connection string.
NpgsqlConnectionDataProvider provider = new NpgsqlConnectionDataProvider("your connection string here");
// Create an instance of the List & Label reporting engine and assign the provider as its data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;
// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, @"C:\Exports\report.pdf", @"C:\Projects\report.llproj");
exportConfiguration.ShowResult = true;
// Export the report to PDF.
listLabel.Export(exportConfiguration);
Remarks
The NpgsqlConnectionDataProvider class extends DbConnectionDataProvider to provide connectivity to PostgreSQL databases via the Npgsql .NET data provider. It supports tables and views, advanced filtering, and schema-aware query construction using customizable identifier delimiter and parameter marker formats. This provider is serializable and can be used as a data source for reporting engines such as List & Label.
Constructors
NpgsqlConnectionDataProvider(IDbConnection)
Initializes a new instance of the NpgsqlConnectionDataProvider class using the specified MySQL connection.
public NpgsqlConnectionDataProvider(IDbConnection connection)
Parameters
connectionIDbConnectionAn open Npgsql connection.
Properties
PrefixTableNameWithSchema
Gets or sets a value indicating whether table names should be prefixed with the schema.
public bool PrefixTableNameWithSchema { get; set; }
Property Value
SupportedElementTypes
Gets or sets the supported DbConnectionElementTypes for the database connection.
public DbConnectionElementTypes SupportedElementTypes { get; set; }
Property Value
Remarks
This property indicates which element types (tables, views) are supported by this data provider.
SupportsAdvancedFiltering
Gets or sets a value indicating whether advanced filtering is supported by this provider.
public override bool SupportsAdvancedFiltering { get; set; }
Property Value
Methods
GetNativeAggregateFunctionName(NativeAggregateFunction)
Gets the native aggregate function name for the specified aggregate function.
protected override string GetNativeAggregateFunctionName(NativeAggregateFunction function)
Parameters
functionNativeAggregateFunctionThe aggregate function to be mapped.
Returns
- string
The native aggregate function name as used by FirebirdSQL, or
nullfor unsupported functions.
Init()
Initializes the data provider by retrieving schema information from the PostgreSQL database.
protected override void Init()
Remarks
The method retrieves tables and views using the GetSchema method of the connection, merges them if necessary, and builds commands to retrieve all data from each table. It also retrieves relation information from the information_schema and adds relations accordingly.
OnTranslateFilterSyntax(object, TranslateFilterSyntaxEventArgs)
Translates filter syntax from List & Label expressions to FirebirdSQL-specific syntax.
protected override void OnTranslateFilterSyntax(object sender, TranslateFilterSyntaxEventArgs e)
Parameters
senderobjectThe source of the filter translation request.
eTranslateFilterSyntaxEventArgsA TranslateFilterSyntaxEventArgs object that contains the event data.