Back to Devexpress

DefaultWebDocumentViewerContainer.RegisterJsonDataConnectionProviderFactory<T>() Method

xtrareports-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-dot-defaultwebdocumentviewercontainer-dot-registerjsondataconnectionproviderfactory-1.md

latest4.2 KB
Original Source

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.v25.2.Web.dll

NuGet Package : DevExpress.Web.Reporting.Common

Declaration

csharp
public static void RegisterJsonDataConnectionProviderFactory<T>()
    where T : IJsonDataConnectionProviderFactory
vb
Public Shared Sub RegisterJsonDataConnectionProviderFactory(Of T As IJsonDataConnectionProviderFactory)

Type Parameters

NameDescription
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:

csharp
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

Register JSON Data Connections (ASP.NET MVC)

DefaultWebDocumentViewerContainer Class

DefaultWebDocumentViewerContainer Members

DevExpress.XtraReports.Web.WebDocumentViewer Namespace