How to Customize the Data Source Wizard
- 3 minutes to read
The Data Source Wizard provides the capability to establish a connection and select data from various sources. If necessary, you can customize this wizard to skip certain pages, specify the list of available data providers, etc. To do this, use the DashboardDesigner.DataSourceWizard property.
The Data Source Wizard provides the following pages:
The first page allows end-users to specify the name of the data source.
The WinForms Designer does not show this page by default. To display it, use the DashboardDesignerDataSourceWizardSettings.ShowDataSourceNamePage property.
The next page allows end-users to select the required data source type.
This page does not contain the Entity Framework and Object Binding by default. To customize the list of displayed data source types, use the DashboardDesignerDataSourceWizardSettings.AvailableDataSourceTypes property.
The next paragraphs describe wizard pages related to specific data source types.
Database
The following page allows end-users to select connections specified in the application configuration file.
By default, the Data Source Wizard does not show this page. 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 using the SqlWizardSettings.DisableNewConnections property. In this case, end-users can only select the data connection specified in the application configuration file.
If an end-user selected No, I’d like to specify the connection parameters myself option on the previous page it invokes the following page:
This page allows end-users to select the required SQL data provider and specify connection parameters. You can customize the list of available data providers using the SqlWizardSettings.AvailableDataProviders property.
The next page allows end-users to decide whether user credentials save into a dashboard definition.
You can manage the saving of user credentials using the SqlWizardSettings.DatabaseCredentialsSavingBehavior property.
The final page of the Data Source Wizard allows end-users to invoke the Query Builder and select the required data.
Note that the Data Source Wizard and Query Builder do not allow end-users to specify SQL queries manually by default. To enable this capability, set the SqlWizardSettings.EnableCustomSql property to true.
Important
The use of custom SQL queries may lead to inadvertent or unauthorized modifications to your data/database structure. Make sure that you follow best practices and implement the appropriate end-user read/write privileges at the database level.
Entity Framework
For the Entity Framework data source, the page allowing users to select the required data context is invoked.
If necessary, you can supply users with the capability to choose a custom assembly providing a required 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.