ICachedReport Interface
Cette interface identifie une classe d'implémentation pouvant être mise en cache dans l'objet Cache ASP.NET à l'aide du SDK de Crystal Reports.
Pour obtenir la liste de tous les membres de ce type, voir les membres de la classe ICachedReport.
ICachedReport
[Visual Basic]
Public Interface ICachedReport
Inherits System.Object
[C#]
public interface ICachedReport : System.Object
Remarques
Pour utiliser le mécanisme de mise en cache intégré, implémentez cette interface dans votre propre classe. Les méthodes et propriétés que vous implémentez seront appelées par le modèle d'objet ReportDocument pour extraire les informations nécessaires à la mise en cache de vos rapports. Attribuez une instance de votre classe à la propriété ReportSource du contrôle CrystalReportViewer pour permettre la mise en cache.
Exemple
[Visual Basic]
Imports System
Imports System.ComponentModel
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared
Public Class CachedReport
Inherits Component
Implements ICachedReport
Private blIsCacheable As Boolean
Private blShareDBLogonInfo As Boolean
Private tsCacheTimeOut As TimeSpan
Private Report As New ReportDocument()
Private reportName As String
Public Sub New(ByVal s As String)
reportName = s
End Sub
Public Overridable Property IsCacheable() As [Boolean] _
Implements CrystalDecisions.ReportSource.ICachedReport.IsCacheable
Get
Return blIsCacheable
End Get
Set(ByVal Value As [Boolean])
blIsCacheable = Value
End Set
End Property
Public Overridable Property ShareDBLogonInfo() _
As [Boolean] Implements _
CrystalDecisions.ReportSource.ICachedReport.ShareDBLogonInfo
Get
Return blShareDBLogonInfo
End Get
Set(ByVal Value As [Boolean])
blShareDBLogonInfo = Value
End Set
End Property
Public Overridable Property CacheTimeOut() _
As TimeSpan Implements _
CrystalDecisions.ReportSource.ICachedReport.CacheTimeOut
Get
Return tsCacheTimeOut
End Get
Set(ByVal Value As TimeSpan)
tsCacheTimeOut = Value
End Set
End Property
Public Overridable Function CreateReport() _
As ReportDocument Implements _
CrystalDecisions.ReportSource.ICachedReport.CreateReport
Report.Load _
(reportName, OpenReportMethod.OpenReportByTempCopy)
Report.Site = Me.Site
Return Report
End Function
Public Overridable Function GetCustomizedCacheKey _
(ByVal request As RequestContext)
As [String] Implements _
CrystalDecisions.ReportSource. _
ICachedReport.GetCustomizedCacheKey
Dim key As [String] = Nothing
key = RequestContext.BuildCompleteCacheKey _
(request, reportName, Me.GetType(), Me.ShareDBLogonInfo)
Return key
End Function
End Class
[C#]
using System;
using System.ComponentModel;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Shared;
public class CachedReport : Component, ICachedReport
{
protected ReportDocument Report = new ReportDocument();
protected bool isCacheable;
protected bool shareDBLogonInfo;
protected string reportName;
protected TimeSpan cacheTimeOut;
public CachedReport(string s)
{
reportName = s;
}
public virtual Boolean IsCacheable
{
get
{
return isCacheable;
}
set
{
isCacheable = value;
}
}
public virtual Boolean ShareDBLogonInfo
{
get
{
return shareDBLogonInfo;
}
set
{
shareDBLogonInfo = value;
}
}
public virtual TimeSpan CacheTimeOut
{
get
{
return cacheTimeOut;
}
set
{
cacheTimeOut = value;
}
}
public virtual ReportDocument CreateReport()
{
Report.Load
(reportName, OpenReportMethod.OpenReportByTempCopy);
Report.Site = this.Site;
return Report;
}
public virtual String GetCustomizedCacheKey
(RequestContext request)
{
String key = null;
key = RequestContext.BuildCompleteCacheKey(
request,
reportName,
this.GetType(),
this.ShareDBLogonInfo);
return key;
}
}
Configuration requise
Espace de noms CrystalDecisions.ReportSource
Assembly CrystalDecisions.ReportSource (CrystalDecisions.ReportSource.dll)
Voir aussi
ICachedReport Membres | CrystalDecisions.ReportSource Espace de noms
©2005 Business Objects SA. Tous droits réservés.
Business Objects SA. http://www.france.businessobjects.com/ Services de support http://www.businessobjects.com/support/ |