Table of Contents

Providing data

List & Label Cross Platform supports a flexible data model that mimics a relational database. At its core, the framework uses the IDataProvider interface - which consists of ITable and ITableRelation objects - to represent data tables and the relationships between them. Developers can implement their own IDataProvider or use one of the many preconfigured providers available in the combit.Reporting.DataProviders namespace.

Note

To keep dependencies to a minimum, most data providers are distributed as separate NuGet packages. You can find an overview of the available packages on NuGet. Refer to the assembly name in the documentation of each data provider implementation. It indicates which package you need to reference.

Binding data using SqlConnectionDataProvider

One common scenario is connecting to a SQL Server database. The SqlConnectionDataProvider is a preconfigured provider that leverages ADO.NET to establish this connection. Below is an example snippet that demonstrates how to bind a SQL database to List & Label:

using combit.Reporting.DataProviders;
using System.Data.SqlClient;

// Define your SQL connection string
string connectionString = "your SQL connection string here";

// Establish a SQL connection
using SqlConnection connection = new SqlConnection(connectionString);

// Create a SQL connection data provider and enable automatic connection closing
var sqlProvider = new SqlConnectionDataProvider(connection);

// Bind the data provider to List & Label
listLabel.DataSource = sqlProvider;
Note

Replace "your SQL connection string here" with your actual connection string. This snippet demonstrates a straightforward way to integrate SQL Server data into your reporting projects.

Top 10 data providers

Below is a table listing the ten most important data providers, chosen based on their relevance for common data formats and relational databases:

Provider name Description
SqlConnectionDataProvider Provides data access capabilities for SQL Server connections.
OracleConnectionDataProvider Implements data provider functionality for Oracle databases using ADO.NET.
MySqlConnectionDataProvider Enables connectivity to MySQL databases via the MySQL Connector/NET.
SQLiteConnectionDataProvider Offers a lightweight provider for SQLite connections, tested with version 1.0.92.0.
AzureSqlDataProvider Connects to Azure SQL databases using an AzureSqlDataProviderConfiguration for cloud scenarios.
AccessDataProvider Provides a data provider implementation for Microsoft Access databases.
CsvDataProvider Extracts data from CSV files, enabling easy integration of comma-separated data sources.
JsonDataProvider Supports data retrieval from JSON data streams, ideal for web APIs and file-based JSON data.
InMemoryDataProvider Wraps existing ITable instances into an in-memory data provider, allowing dynamic data manipulation.
OdbcConnectionDataProvider Offers a generic provider for databases accessible via ODBC connections, ensuring broad compatibility.
Tip

All these providers are available in the combit.Reporting.DataProviders namespace. Depending on your application's requirements, you may choose to implement a custom IDataProvider or leverage these preconfigured solutions.


By using these data providers, you can easily integrate various data sources into your List & Label projects, enabling dynamic report generation across diverse environments.