skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Use Reports in Applications
    • System Requirements
    • Forums
    • Videos
    • Blogs
    • Submit a Ticket
    • FAQs
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now
Search all

Class ReportsHostBase

Represents the base host for the reports services which needs to be inherited in the client application

Inheritance
System.Object
ReportsHostBase
Namespace: Telerik.Reporting.Services.ServiceStack
Assembly: Telerik.Reporting.Services.ServiceStack.dll

Syntax

public abstract class ReportsHostBase : AppHostBase, IExtensibilityPoints

Constructors

ReportsHostBase()

Declaration
protected ReportsHostBase()

Properties

ReportServiceConfiguration

Gets or sets the configuration of the report service.

Declaration
public IReportServiceConfiguration ReportServiceConfiguration { get; set; }
Property Value
IReportServiceConfiguration

Remarks

When inheriting the ReportsControllerBase controller basic configuration is needed. Provide an object implementing the IReportServiceConfiguration in order to configure the report service. This should be done in the controllers' constructor using static object to preserve the configuration between requests or using dependency injection.

Examples

This example shows how to configure WebAPI service using the ReportServiceConfiguration object.

public class ReportsHost : Telerik.Reporting.Services.ServiceStack.ReportsHostBase
{
    public ReportsHost()
    {
        var reportsPath = System.Web.HttpContext.Current.Server.MapPath(@"~\Reports");
        var resolver = new Telerik.Reporting.Services.UriReportSourceResolver(reportsPath)
            .AddFallbackResolver(new Telerik.Reporting.Services.TypeReportSourceResolver());

        var reportServiceConfiguration = new Telerik.Reporting.Services.ReportServiceConfiguration();
        reportServiceConfiguration.HostAppId = "Application1";
        reportServiceConfiguration.ReportSourceResolver = resolver;
        reportServiceConfiguration.Storage = new Telerik.Reporting.Cache.File.FileStorage();

        this.ReportServiceConfiguration = reportServiceConfiguration;
    }
}
Imports Telerik.Reporting.Services

Public Class ReportsHost
    Inherits Telerik.Reporting.Services.ServiceStack.ReportsHostBase
    Public Sub New()
        Dim reportsPath = System.Web.HttpContext.Current.Server.MapPath("~\Reports")
        Dim resolver = New UriReportSourceResolver(reportsPath) _
                       .AddFallbackResolver(New TypeReportSourceResolver())

        Dim reportServiceConfiguration = New ReportServiceConfiguration()
        reportServiceConfiguration.HostAppId = "Application1"
        reportServiceConfiguration.ReportSourceResolver = resolver
        reportServiceConfiguration.Storage = New Telerik.Reporting.Cache.File.FileStorage()

        Me.ReportServiceConfiguration = reportServiceConfiguration
    End Sub
End Class
See Also
IReportServiceConfiguration
ReportServiceConfiguration

Methods

Configure(Container)

Declaration
public override void Configure(Container container)
Parameters
Funq.Container container

CreateCache()

Creates an ICache implementation instance that will be used for internal storage from the service.

Declaration
[Obsolete("CreateReportResolver method is now obsolete. Please provide service setup using the Telerik.Reporting.Services.ServiceStack.ReportsHostBase.ReportServiceConfiguration property.")]
protected virtual ICache CreateCache()
Returns
ICache

An instance of cache that will be used from the controller in order to preserve its cache/state.

Remarks

Override this method in order to create the cache instance. May be one of the built-in caching implementations or a custom implementation. To use one of the built-in caching implementations use the CacheFactory class.

See Also
CacheFactory

CreateMailMessage(SendDocumentArgs, DocumentData)

Creates the mail message that will be used in SendDocument

Declaration
protected virtual MailMessage CreateMailMessage(SendDocumentArgs args, DocumentData result)
Parameters
SendDocumentArgs args

The args to use in the mail message

DocumentData result

The document to attach to the mail message

Returns
System.Net.Mail.MailMessage

Mail message

CreateReportResolver()

Creates an IReportResolver implementation instance that will be used for report resolving from the service

Declaration
[Obsolete("CreateReportResolver method is now obsolete. Please provide service setup using the Telerik.Reporting.Services.ServiceStack.ReportsHostBase.ReportServiceConfiguration property.")]
protected virtual IReportResolver CreateReportResolver()
Returns
IReportResolver

Returns the created instance.

Remarks

Override this method in order to create the report resolver instance. May be one of the built-in report resolvers or a custom implementation resolver. Built-in resolvers may be chained.

See Also
IReportResolver
ReportFileResolver
ReportTypeResolver

CreateStorage()

Creates an IStorage implementation instance that will be used for internal storage from the service.

Declaration
[Obsolete("CreateReportResolver method is now obsolete. Please provide service setup using the Telerik.Reporting.Services.ServiceStack.ReportsHostBase.ReportServiceConfiguration property.")]
protected virtual IStorage CreateStorage()
Returns
IStorage

An instance of storage that will be used from the controller in order to preserve its cache/state.

Remarks

Override this method in order to create the storage instance. May be one of the built-in storage implementations or a custom implementation. MsSqlServerStorage RedisStorage

See Also
CacheFactory

GetUserIdentity()

Override this method to substitute the default UserIdentity retrieval logic, which uses System.Web.HttpContext.Current.User.Identity

Declaration
protected virtual UserIdentity GetUserIdentity()
Returns
UserIdentity

The UserIdentity object instance, that can be later retrieved by Current property or by using expression =UserIdentity

OnCreateDocument(CreateDocumentEventArgs)

Called when document is requested, before rendering the document.

Declaration
protected virtual void OnCreateDocument(CreateDocumentEventArgs args)
Parameters
CreateDocumentEventArgs args

The args describing the rendering document

OnGetDocument(GetDocumentEventArgs)

Called when document is requested, before sending the response.

Declaration
protected virtual void OnGetDocument(GetDocumentEventArgs args)
Parameters
GetDocumentEventArgs args

The args describing the rendered document

SendMailMessage(MailMessage)

Sends an e-mail message containing a report document to its recipients. Override this method in order to effectively send the mail message.

Declaration
protected virtual HttpStatusCode SendMailMessage(MailMessage mailMessage)
Parameters
System.Net.Mail.MailMessage mailMessage

The mail message to send

Returns
System.Net.HttpStatusCode

The default value is NotImplemented.

Remarks

The default implementation of this method is empty. Override this method in order to use the feature.

Examples
protected override HttpStatusCode SendMailMessage(MailMessage mailMessage)
{
    using (var smtpClient = new SmtpClient("smtp.companyname.com", 25))
    {
        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtpClient.EnableSsl = true;
        smtpClient.Send(mailMessage);
    }

    return HttpStatusCode.OK;
}
Protected Overrides Function SendMailMessage(ByVal mailMessage As MailMessage) As HttpStatusCode
    Using smtpClient = New SmtpClient("smtp.companyname.com", 25)
        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network
        smtpClient.EnableSsl = True
        smtpClient.Send(mailMessage)
    End Using

    Return HttpStatusCode.OK
End Function

Explicit Interface Implementations

IExtensibilityPoints.CreateMailMessage(SendDocumentArgs, DocumentData)

Declaration
MailMessage IExtensibilityPoints.CreateMailMessage(SendDocumentArgs args, DocumentData result)
Parameters
SendDocumentArgs args

DocumentData result

Returns
System.Net.Mail.MailMessage

Implements
IExtensibilityPoints.CreateMailMessage(SendDocumentArgs, DocumentData)

IExtensibilityPoints.GetUserIdentity()

Declaration
UserIdentity IExtensibilityPoints.GetUserIdentity()
Returns
UserIdentity

Implements
IExtensibilityPoints.GetUserIdentity()

IExtensibilityPoints.OnCreateDocument(CreateDocumentEventArgs)

Declaration
void IExtensibilityPoints.OnCreateDocument(CreateDocumentEventArgs args)
Parameters
CreateDocumentEventArgs args

Implements
IExtensibilityPoints.OnCreateDocument(CreateDocumentEventArgs)

IExtensibilityPoints.OnGetDocument(GetDocumentEventArgs)

Declaration
void IExtensibilityPoints.OnGetDocument(GetDocumentEventArgs args)
Parameters
GetDocumentEventArgs args

Implements
IExtensibilityPoints.OnGetDocument(GetDocumentEventArgs)

IExtensibilityPoints.SendMailMessage(MailMessage)

Declaration
HttpStatusCode IExtensibilityPoints.SendMailMessage(MailMessage mailMessage)
Parameters
System.Net.Mail.MailMessage mailMessage

Returns
System.Net.HttpStatusCode

Implements
IExtensibilityPoints.SendMailMessage(MailMessage)
Getting Started
  • Install Now
  • Online Demos
Support Resources
  • Documentation
  • Knowledge Base
  • Videos
  • Reporting Samples Repository
  • Reporting Release History
Community
  • Forums
  • Blogs
  • Reporting Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.