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

IDataSourceWizardConnectionStringsProvider Interface

If implemented, this interface allows you to manage data connections in web components.

Namespace: DevExpress.DataAccess.Web

Assembly: DevExpress.DataAccess.v20.2.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.WindowsDesktop.DataAccess

Declaration

public interface IDataSourceWizardConnectionStringsProvider

Remarks

In the ASP.NET Report Designer and Web Dashboard components, users can invoke the Data Source Wizard to connect to SQL databases. This wizard allows users to select a predefined data connection, connect to the specified database, and select data.

The IDataSourceWizardConnectionStringsProvider interface allows you to implement a provider of connection strings that should be displayed in the Data Source Wizard’s UI. It also resolves connection parameters for reports that are previewed in the Document Viewer (both standalone and embedded in the Report Designer).

The topics below describe how to implement IDataSourceWizardConnectionStringsProvider for different components.

You can use IDataSourceWizardConnectionStringsProvider only with SQL data sources. Refer to the following topics for instructions on how to supply data from other data source types:

Example

This example shows how to implement the IDataSourceWizardConnectionStringsProvider interface to create a custom connection string provider.

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.Remove("LocalSqlServer");
            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);
            }
            return AppConfigHelper.LoadConnectionParameters(name);
        }
    }
See Also