Skip to main content

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.v25.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>();
            // ...
        }
    // ...
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the RegisterJsonDataConnectionProviderFactory<T>() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also