Class ReportsHostBase
Represents the base host for the reports services which needs to be inherited in the client application
Inheritance
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
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
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
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
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.GetUserIdentity()
IExtensibilityPoints.OnCreateDocument(CreateDocumentEventArgs)
Declaration
void IExtensibilityPoints.OnCreateDocument(CreateDocumentEventArgs args)
Parameters
CreateDocumentEventArgs
args
|
Implements
IExtensibilityPoints.OnGetDocument(GetDocumentEventArgs)
Declaration
void IExtensibilityPoints.OnGetDocument(GetDocumentEventArgs args)
Parameters
GetDocumentEventArgs
args
|
Implements
IExtensibilityPoints.SendMailMessage(MailMessage)
Declaration
HttpStatusCode IExtensibilityPoints.SendMailMessage(MailMessage mailMessage)
Parameters
System.Net.Mail.MailMessage
mailMessage
|
Returns
System.Net.HttpStatusCode
|