xtrareports-401655-web-reporting-asp-net-core-reporting-end-user-report-designer-in-asp-net-applications-use-data-sources-and-connections-json-data-register-connections.md
This document describes how to provide JSON data connections to the Web Report Designer. The Data Source Wizard displays these connections when users create new JSON data sources.
The Data Source Wizard allows you to create a new JSON data source if a JSON data connection provider is registered in the application. You can register a built-in connection provider or implement and register a custom provider:
Built-in connection providerThe provider obtains connections from the application’s configuration file (appsettings.json).Custom connection providerThe provider allows you to create connection strings at runtime and use custom storage to store/load connection strings and credentials.
Follow the steps below to use connection strings from the application configuration file:
Add data connections to the application’s configuration file (appsettings.json).
Register the built-in connection string provider. Call the static ReportDesignerConfigurationBuilder.RegisterDataSourceWizardConfigFileJsonConnectionStringsProvider method at application startup.
If you use data connections from appsettings.json, you cannot use a custom connection string provider described in the next section.
A custom connection provider allows you to manage JSON connections that are accessible to users:
Tip
To review a sample JSON connection provider and storage implementation, use DevExpress templates to create an ASP.NET Core Reporting application. When creating the project, enable the Add Sample JSON Data Connection Storage option. Refer to the following help topic for more information: Use DevExpress Visual Studio Templates to Create an ASP.NET Core Reporting App with a Report Designer.
To use a custom JSON connection provider, follow the steps below:
Create a class that implements the IDataSourceWizardJsonConnectionStorage interface. The implementation below stores connections in a session.
Create a new class (CustomJsonDataConnectionProviderFactory in this example) that implements the IJsonDataConnectionProviderFactory interface.
Register services at application startup:
After you register a custom JSON connection provider, you can do the following:
Use an existing connection to create a new JSON data source:
Create a new JSON connection:
See Also
SQL Database - Customize the Schema