All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

DashboardConfigurator.SetConnectionStringsProvider(IDataSourceWizardConnectionStringsStorage) Method

Specifies a provider of data connections that can be used by the Web Dashboard.

Namespace: DevExpress.DashboardWeb

Assembly: DevExpress.Dashboard.v20.1.Web.dll

Declaration

public void SetConnectionStringsProvider(
    IDataSourceWizardConnectionStringsStorage storage
)
Public Sub SetConnectionStringsProvider(
    storage As IDataSourceWizardConnectionStringsStorage
)

Parameters

Name Type Description
storage IDataSourceWizardConnectionStringsStorage

A storage that implements the IDataSourceWizardConnectionStringsStorage interface and allows you to save the created JSON data connections.

Remarks

Use the following overload to allow end users to save JSON data connections and create new data sources based on them.

To enable the capability to create new JSON data connections for end users, set the allowCreateNewJsonConnection property to true:

Platform API
HTML JavaScript DataSourceWizardExtensionOptions.allowCreateNewJsonConnection
ASP.NET Core DataSourceWizardOptionBuilder.AllowCreateNewJsonConnection
MVC DashboardExtensionSettings.AllowCreateNewJsonConnection
Web Forms ASPxDashboard.AllowCreateNewJsonConnection

Implement the IDataSourceWizardConnectionStringsStorage interface and use the created class instance as a method's parameter.

using DevExpress.DashboardWeb;
using DevExpress.DataAccess.Web;
using DevExpress.DataAccess.ConnectionParameters;
using System.Linq;
// ...
public void ConfigureServices(IServiceCollection services) {
            services
                .AddMvc()
                .AddDefaultDashboardController((configurator, serviceProvider)  => {
                    configurator.SetConnectionStringsProvider(new ConnectionStringProvider());
                });

            services.AddDevExpressControls();
        }

public class ConnectionStringProvider: IDataSourceWizardConnectionStringsStorage {
    readonly Dictionary<string, DataConnectionParametersBase> storage = new Dictionary<string, DataConnectionParametersBase>();
    public Dictionary<string, string> GetConnectionDescriptions() {

        return storage.ToDictionary(p=>p.Key, p=>p.Key);
    }

    public DataConnectionParametersBase GetDataConnectionParameters(string name) {
        return storage[name];
    }

    public void SaveDataConnectionParameters(string name, DataConnectionParametersBase connectionParameters, bool saveCredentials) {
        storage[name] = connectionParameters;
    }
}
See Also