Class AzureSqlDataProvider
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.SqlConnectionDataProvider.dll
Provides a data provider for connecting to Microsoft Azure SQL databases.
[Serializable]
public class AzureSqlDataProvider : SqlConnectionDataProvider, IDataProvider, ICanHandleUsedIdentifiers, IDisposable, ISupportsLogger, ISerializable
- Inheritance
-
AzureSqlDataProvider
- Implements
- Inherited Members
Examples
The following example demonstrates how to use the AzureSqlDataProvider to export a report to PDF:
// Example 1: Using Azure AD Integrated Authentication (for domain-joined machines)
AzureSqlDataProviderConfiguration config = new AzureSqlDataProviderConfiguration(
"myserver.database.windows.net",
"mydatabase",
AzureSqlDataProviderAuthenticationType.IntegratedWindowsAuthentication);
// Optional: Configure connection settings
config.Encrypt = true; // Enabled by default
config.MultipleActiveResultSets = false;
config.Port = 1433; // Default Azure SQL port
// Create the AzureSqlDataProvider
AzureSqlDataProvider provider = new AzureSqlDataProvider(config);
// Create a ListLabel reporting engine instance and assign the provider as the data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;
// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;
// Export the report to PDF.
listLabel.Export(exportConfiguration);
// Example 2: Using Azure AD Identity (username and password)
AzureSqlDataProviderConfiguration adConfig = new AzureSqlDataProviderConfiguration(
"myserver.database.windows.net",
"mydatabase",
AzureSqlDataProviderAuthenticationType.AzureADIdentity);
adConfig.UserName = "user@domain.com";
adConfig.Password = "your_password_here";
AzureSqlDataProvider adProvider = new AzureSqlDataProvider(adConfig);
// Example 3: Filtering by specific schema
AzureSqlDataProvider schemaProvider = new AzureSqlDataProvider(config, "dbo");
// Example 4: Using custom connection string override
AzureSqlDataProviderConfiguration customConfig = new AzureSqlDataProviderConfiguration(
"myserver.database.windows.net",
"mydatabase",
AzureSqlDataProviderAuthenticationType.IntegratedWindowsAuthentication);
customConfig.ConnectionStringOverride = "your custom connection string here";
AzureSqlDataProvider customProvider = new AzureSqlDataProvider(customConfig);
Remarks
The AzureSqlDataProvider class extends SqlConnectionDataProvider to provide specialized connectivity to Azure SQL Database, Microsoft's cloud-based relational database service. It simplifies authentication by supporting both Azure Active Directory Integrated authentication and Azure AD username/password authentication. The provider uses an AzureSqlDataProviderConfiguration object to configure connection parameters including server address, database name, authentication type, encryption settings, and Multiple Active Result Sets (MARS) support. All features of SqlConnectionDataProvider are available, including tables, views, advanced filtering, schema-based filtering, and automatic discovery of foreign key relationships. The provider automatically constructs Azure SQL-specific connection strings with proper security settings and supports schema filtering to limit data access to specific database schemas.
Constructors
AzureSqlDataProvider(SerializationInfo, StreamingContext)
protected AzureSqlDataProvider(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfocontextStreamingContext
AzureSqlDataProvider(AzureSqlDataProviderConfiguration)
Constructs an instance of the AzureSqlDataProvider
public AzureSqlDataProvider(AzureSqlDataProviderConfiguration configuration)
Parameters
configurationAzureSqlDataProviderConfigurationThe configuration to use
AzureSqlDataProvider(AzureSqlDataProviderConfiguration, ReadOnlyCollection<string>)
Constructs an instance of the AzureSqlDataProvider
public AzureSqlDataProvider(AzureSqlDataProviderConfiguration configuration, ReadOnlyCollection<string> tableSchemas)
Parameters
configurationAzureSqlDataProviderConfigurationThe configuration to use
tableSchemasReadOnlyCollection<string>The provided data will be restricted to these schemas
AzureSqlDataProvider(AzureSqlDataProviderConfiguration, string)
Constructs an instance of the AzureSqlDataProvider
public AzureSqlDataProvider(AzureSqlDataProviderConfiguration configuration, string tableSchema)
Parameters
configurationAzureSqlDataProviderConfigurationThe configuration to use
tableSchemastringThe provided data will be restricted to this schema