Skip to main content

DashboardConnectionStringsProvider Class

A data connection string provider for ASP.NET Core. This provider allows users to create new data sources based on predefined connection strings from the configuration file.

Namespace: DevExpress.DashboardAspNetCore

Assembly: DevExpress.Dashboard.v24.1.AspNetCore.dll

NuGet Package: DevExpress.AspNetCore.Dashboard

Declaration

public class DashboardConnectionStringsProvider :
    IDataSourceWizardConnectionStringsProvider

Remarks

The Web Dashboard control does not expose connection strings from the configuration file. You can allow users to create new data sources based on connection strings. To do this, you need a data connection string provider (an IDataSourceWizardConnectionStringsProvider interface implementation).

You can use a predefined data connection string provider or implement a custom provider.

Predefined Provider

The DashboardConnectionStringsProvider is a predefined implementation of the IDataSourceWizardConnectionStringsProvider interface. This provider makes all connection strings in the appsettings.json file available to users. Pass the DashboardConnectionStringsProvider instance to the DashboardConfigurator.SetConnectionStringsProvider method call to allow users to create new data sources based on connection strings from the configuration file:

using DevExpress.DataAccess.Web;
// ...
  services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => {
      DashboardConfigurator configurator = new DashboardConfigurator();
      configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));
      return configurator;
  });

Note

In ASP.NET Web Forms and ASP.NET MVC applications, use the ConfigFileConnectionStringsProvider as the predefined implementation of a data connection string provider.

Custom Provider

If you implement the IDataSourceWizardConnectionStringsProvider interface and create your own data connection string provider, you can add custom logic to your application. For example, you can use a custom provider to read connection strings from a custom source (a local file or database).

Security Considerations

For more information on security considerations in the Web Dashboard, refer to the following article: Security Considerations in ASP.NET Core .

Inheritance

Object
DashboardConnectionStringsProvider
See Also