Skip to main content

DefaultWebDocumentViewerContainer.RegisterJsonDataConnectionProviderFactory<T>() Method

Registers a factory that returns a service that provides a JSON connection string by name.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v23.2.Web.dll

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public static void RegisterJsonDataConnectionProviderFactory<T>()
    where T : IJsonDataConnectionProviderFactory

Type Parameters

Name Description
T

A type that implements the DevExpress.DataAccess.Web.IJsonDataConnectionProviderFactory interface.

Remarks

Call this method on application startup if you use the DefaultReportDesignerContainer.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>();
            // ...
        }
    // ...
    }
}
See Also