Skip to main content
A newer version of this page is available. .

DashboardConfigurator.SetConnectionStringsProvider(IDataSourceWizardConnectionStringsProvider) Method

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

Namespace: DevExpress.DashboardWeb

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

Declaration

public void SetConnectionStringsProvider(
    IDataSourceWizardConnectionStringsProvider provider
)

Parameters

Name Type Description
provider IDataSourceWizardConnectionStringsProvider

An object implementing the IDataSourceWizardConnectionStringsProvider interface.

Remarks

Important

To learn how to use the DashboardConfigurator‘s API, see the Server-Side API Overview topic.

This example shows how to implement a custom provider of connection strings by implementing the IDataSourceWizardConnectionStringsProvider interface.

using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Native;
using DevExpress.DataAccess.Web;
// ...

    public class MyDataSourceWizardConnectionStringsProvider : IDataSourceWizardConnectionStringsProvider
    {
        public Dictionary<string, string> GetConnectionDescriptions() {
            Dictionary<string, string> connections = new Dictionary<string, string>();

            // Customize the loaded connections list.  
            connections.Add("msAccessConnection", "MS Access Connection");
            connections.Add("msSqlConnection", "MS SQL Connection");
            return connections;
        }

        public DataConnectionParametersBase GetDataConnectionParameters(string name) {
            // Return custom connection parameters for the custom connection.
            if (name == "msAccessConnection") {
                return new Access97ConnectionParameters("|DataDirectory|nwind.mdb", "", "");
            } else if (name == "msSqlConnection") { 
                return new MsSqlConnectionParameters("localhost", "Northwind", "", "", MsSqlAuthorizationType.Windows);
            } 
            throw new System.Exception("The connection string is undefined.");
        }
    }

After you have implemented a custom provider of connection strings, pass the instance of this class to the DashboardConfigurator.SetConnectionStringsProvider method.

using DevExpress.DashboardWeb;
// ...
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            // ...
            DashboardConfigurator.Default.SetConnectionStringsProvider(new MyDataSourceWizardConnectionStringsProvider());
        }
        // ...
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetConnectionStringsProvider(IDataSourceWizardConnectionStringsProvider) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also