IDataSourceWizardConnectionStringsStorage Interface
When implemented by a class, represents a storage of data connections used in the Dashboard Data Source Wizard.
Namespace: DevExpress.DashboardWeb
Assembly: DevExpress.Dashboard.v23.1.Web.dll
NuGet Package: DevExpress.Web.Dashboard.Common
Declaration
public interface IDataSourceWizardConnectionStringsStorage :
IDataSourceWizardConnectionStringsProvider
Remarks
The following code snippet shows how to save the created connection strings in the the ASP.NET Core dashboard application.
using DevExpress.DashboardWeb;
using DevExpress.DataAccess.ConnectionParameters;
using System.Collections.Generic;
using System.Linq;
// ...
public void ConfigureServices(IServiceCollection services) {
services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => {
DashboardConfigurator configurator = new DashboardConfigurator();
// ...
// Use the ConnectionStringProvider instance as the SetConnectionStringsProvider method's parameter.
configurator.SetConnectionStringsProvider(new ConnectionStringProvider());
// ...
return configurator;
});
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