Skip to main content

ReportDesignerConfigurationBuilder.RegisterDataSourceWizardConnectionStringsProvider<T>(Boolean) Method

Registers a custom connection string provider that supplies data connections for the Data Source Wizard.

Namespace: DevExpress.AspNetCore.Reporting

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

NuGet Package: DevExpress.AspNetCore.Reporting

Declaration

public ReportDesignerConfigurationBuilder RegisterDataSourceWizardConnectionStringsProvider<T>(
    bool overrideWebConfigConnections
)
    where T : class, IDataSourceWizardConnectionStringsProvider, new()

Parameters

Name Type Description
overrideWebConfigConnections Boolean

If true, only the connection name is serialized with report definition. If false, data connection parameters are serialized with the report data source when the report is passed to the client.

Type Parameters

Name Description
T

A custom connection string provider that implements the IDataSourceWizardConnectionStringsProvider interface.

Returns

Type Description
ReportDesignerConfigurationBuilder

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

Remarks

How to Use the Method

A connection string provider defines which data connections are available in the Web Report Designer. To create a custom provider, implement the IDataSourceWizardConnectionStringsProvider interface. To use the custom provider in your application, call the RegisterDataSourceWizardConnectionStringsProvider method with the custom provider as a typed parameter:

using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Native;
using DevExpress.DataAccess.Web;
using System.Collections.Generic;
// ... 

public class MyDataSourceWizardConnectionStringsProvider : IDataSourceWizardConnectionStringsProvider {
    public Dictionary<string, string> GetConnectionDescriptions() {
        // Load a list of connections.
        // ...
    }

    public DataConnectionParametersBase GetDataConnectionParameters(string name) {
      // Return connection parameters for the connection specified by its name.
      // ..
    }
}

Method Details

In the code above, the RegisterDataSourceWizardConnectionStringsProvider method is called with the boolean parameter set to true. In this instance, only the connection name is serialized with report definition. It provides connection security because no data connection parameters are saved with report layouts. When the Web Document Viewer or the Report Designer’s Preview generates a document, connection parameters are requested from the custom connection string provider.

Note

The built-in connection string provider gets connection information from the appsettings.json file.

If you pass false as the RegisterDataSourceWizardConnectionStringsProvider method parameter, data connection parameters are serialized with the report data source when the report is passed to the client. These parameters are encrypted by the default ASP.NET Core data protection service. You can also implement the ISecureDataConverter interface to provide a custom data protection mechanism.

To prevent serialization of data connection parameters, you can alternatively use the technique described in the RegisterDataSourceWizardConnectionStringsProvider<T>() reference topic. It uses a method overload without parameters and allows you to apply the dependency injection pattern.

Notes

See Also