WebDocumentViewerConfigurationBuilder.RegisterJsonDataConnectionProviderFactory<T>() Method
Registers a factory that returns a service that provides a JSON connection string by name.
Namespace: DevExpress.AspNetCore.Reporting
Assembly: DevExpress.AspNetCore.Reporting.v20.2.dll
NuGet Package: DevExpress.AspNetCore.Reporting
Declaration
public WebDocumentViewerConfigurationBuilder RegisterJsonDataConnectionProviderFactory<T>()
where T : class, IJsonDataConnectionProviderFactory
Type Parameters
Name | Description |
---|---|
T | A type that implements the DevExpress.DataAccess.Web.IJsonDataConnectionProviderFactory interface. |
Returns
Type | Description |
---|---|
WebDocumentViewerConfigurationBuilder | A WebDocumentViewerConfigurationBuilder that can be used to further configure the Web Document Viewer services. |
Remarks
Call this method on application startup if you use the ReportDesignerConfigurationBuilder.RegisterDataSourceWizardJsonConnectionStorage method to register a custom JSON connection storage and specify the method’s parameter to true.
In this situation, the Document Viewer calls the IJsonDataConnectionProviderFactory.Create method to obtain an object with the IJsonDataConnectionProviderService interface that provides the JSON connection string.
The following code snippet illustrates how to use the RegisterJsonDataConnectionProviderFactory method:
using DevExpress.DataAccess.Web;
using DevExpress.XtraReports.Web.Extensions;
using DevExpress.XtraReports.Web.QueryBuilder;
using DevExpress.XtraReports.Web.QueryBuilder.Native;
using DevExpress.XtraReports.Web.ReportDesigner;
using DevExpress.XtraReports.Web.ReportDesigner.Native;
using DevExpress.XtraReports.Web.WebDocumentViewer;
using DevExpress.XtraReports.Web.WebDocumentViewer.Native;
using System;
using System.Web.SessionState;
namespace WebApplication1
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
ReportDesignerBootstrapper.SessionState = SessionStateBehavior.Required;
WebDocumentViewerBootstrapper.SessionState = SessionStateBehavior.Required;
QueryBuilderBootstrapper.SessionState = SessionStateBehavior.Required;
// ...
DefaultReportDesignerContainer.RegisterDataSourceWizardConfigFileJsonConnectionStringsProvider();
DefaultReportDesignerContainer.RegisterDataSourceWizardJsonConnectionStorage<CustomDataSourceWizardJsonDataConnectionStorage>(true);
DefaultWebDocumentViewerContainer.Register<IJsonDataConnectionProviderFactory, CustomJsonDataConnectionProviderFactory>();
DefaultQueryBuilderContainer.Register<IJsonDataConnectionProviderFactory, CustomJsonDataConnectionProviderFactory>();
// ...
}
// ...
}
}