How to Customize the Data Source Wizard
- 3 minutes to read
The Data Source Wizard allows you to establish a connection and select data from various sources. You can use the DashboardDesigner.DataSourceWizard property to customize this wizard to skip certain pages, specify the list of available data providers, and so on.
The Data Source Wizard consists of the following main pages:
The first page allows users to specify the name of the data source.
The WinForms Designer does not initially show this page (the default setting). To display it, use the DashboardDesignerDataSourceWizardSettings.ShowDataSourceNamePage property.
The next page allows users to select the data connection type.
Set the DataSourceWizardSettings.UseMergedConnectionTypePage property to
true
to use the wizard design illustrated above.Initially, this page does not contain the eXpress Persistent Objects (XPO). To customize the list of displayed data source types, use the DashboardDesignerDataSourceWizardSettings.AvailableDataSourceTypes property. Also, you can limit the SQL data providers displayed in the Select a Data Connection Type page with the DashboardDataSourceWizardSettings.AvailableSqlDataProviders property.
The subsequent paragraphs describe wizard pages related to specific data connection types.
Database
The following page allows users to select connections specified in the application configuration file for the selected data connection type:
The Data Source Wizard does not initially show this page (the default setting). To display this page, set the DashboardDesignerDataSourceWizardSettings.ShowConnectionsFromAppConfig property to true.
Important
Note that you can disable the creation of new connections in the Data Source Wizard. For this, use the SqlWizardSettings.DisableNewConnections property. In this case, users can only select the data connection specified in the application configuration file.
If a user selected No, I’d like to specify the connection parameters myself option on the previous page, the following page is shown:
This page allows users to specify connection parameters for the selected data connection type.
The next page allows users to decide whether user credentials are saved in a dashboard definition.
The SqlWizardSettings.DatabaseCredentialsSavingBehavior property allows you to save user credentials.
The final page of the Data Source Wizard allows users to invoke the Query Builder and select data.
Note that the Data Source Wizard and Query Builder do not allow users to specify SQL queries. To enable this feature, set the SqlWizardSettings.EnableCustomSql property to true.
Warning
The use of custom SQL queries can lead to inadvertent or unauthorized modifications to your data/database structure. Ensure that you follow best practices and implement the appropriate user read/write privileges at database level.
Entity Framework
For the Entity Framework data source, the invoked page allows users to select data context.
If necessary, you can allow users to choose a custom assembly that contains a data context. To do this, enable the EFWizardSettings.ShowBrowseButton flag to add the Browse button to this page. Then, handle the EFDataSource.BeforeLoadCustomAssemblyGlobal event to manage custom assembly loading.