Search results
Suggest a FeaturePDF

How to configure WebAPI Data Processing Extension for Report Viewer

This section explains the steps required to register and load WebAPI data extensions in Web Report Viewer application.

Install WebAPI data source extension NuGet

To register and load WebAPI data sources in the application install BoldReports.Data.WebData package in the application.

Right-click the project or solution in the Solution Explorer tab, and choose Manage NuGet Packages. Alternatively, select the Tools > NuGet Package Manager > Manage NuGet Packages for Solution menu command.

Search for BoldReports.Data.WebData NuGet package, and install it in your application.

Built in WebAPI

Register WebAPI data source extension in application startup

ASP.NET

To register the extension in the ASP.NET Web application, follow these steps.

  1. Open the code-behind file Global.asax.cs and add the following using statement.

    Copied !
        using BoldReports.Web;
  2. Then register the assembly name BoldReports.Data.WebData in Application_Start using ReportConfig.DefaultSettings as follows to use the WebAPI data extension.

    Copied !
        protected void Application_Start(object sender, EventArgs e)
        {
            System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional });
    
            AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
    
            //Use the below code to register extensions assembly into report designer
            ReportConfig.DefaultSettings = new ReportSettings().RegisterExtensions(new List<string> { "BoldReports.Data.WebData" });
        }

ASP.NET Core

To register the extension in the ASP.NET Core application, follow these steps.

  1. Open the file Startup.cs and add the following using statement.

    Copied !
        using BoldReports.Web;
  2. Then register the package name BoldReports.Data.WebData in Startup as follows using ReportConfig.DefaultSettings as follows to use the WebAPI data extension.

    Copied !
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
    
            AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
    
            //Use the below code to register extensions assembly into report designer
            ReportConfig.DefaultSettings = new ReportSettings().RegisterExtensions(new List<string> { "BoldReports.Data.WebData" });
        }

To register multiple data extensions in the application, provide the assembly name’s as list of strings.