Skip to main content

ReportDesignerConfigurationBuilder.RegisterDataSourceWizardConfigFileConnectionStringsProvider() Method

Registers the predefined connection string provider that enables the Web Report Designer to use connection strings specified in the project’s appsettings.json file.

Namespace: DevExpress.AspNetCore.Reporting

Assembly: DevExpress.AspNetCore.Reporting.v23.2.dll

NuGet Package: DevExpress.AspNetCore.Reporting

Declaration

public ReportDesignerConfigurationBuilder RegisterDataSourceWizardConfigFileConnectionStringsProvider()

Returns

Type Description
ReportDesignerConfigurationBuilder

A ReportDesignerConfigurationBuilder that can be used to further configure the Report Designer services.

Remarks

To allow end-users to create new data sources in the Web Report Designer, you should register connection strings explicitly. The Data Source Wizard displays these connections.

The default connection string provider implementation searches the appsettings.json file in the current directory and reads connection strings from the file’s ConnectionStrings section. To enable the Report Designer to use this provider, call the static RegisterDataSourceWizardConfigFileConnectionStringsProvider method at the application’s startup.

using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDevExpressControls();
builder.Services.AddMvc(); 

builder.Services.ConfigureReportingServices(configurator => {
    configurator.ConfigureReportDesigner(designerConfigurator => {
        designerConfigurator.RegisterDataSourceWizardConfigFileConnectionStringsProvider();
    });
});        

var app = builder.Build();

You can also use the static DefaultConnectionStringProvider.AssignConnectionStrings method to override the default connection string provider. For instance, this method allows you to get connection strings from a set of different configuration sources, such as appsettings.Development.json, connectionStrings.json, in-memory collection, etc.

See SQL Database - Register Connections for more information.

Important

When the SQL Data Source wizard obtains connection strings from the appsettings.json file, only the connection names are serialized with the report definition.

See Also