AspNetCacheProfileAttribute 类

定义

应用于服务操作时,指示配置文件中的 ASP.NET 输出缓存配置文件,WCF 应使用该配置文件来缓存 ASP .NET 输出缓存中操作的响应。

public ref class AspNetCacheProfileAttribute sealed : Attribute, System::ServiceModel::Description::IOperationBehavior
[System.AttributeUsage(System.AttributeTargets.Method)]
public sealed class AspNetCacheProfileAttribute : Attribute, System.ServiceModel.Description.IOperationBehavior
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type AspNetCacheProfileAttribute = class
    inherit Attribute
    interface IOperationBehavior
Public NotInheritable Class AspNetCacheProfileAttribute
Inherits Attribute
Implements IOperationBehavior
继承
AspNetCacheProfileAttribute
属性
实现

示例

以下示例演示如何将 AspNetCacheProfileAttribute 属性应用于服务操作。 在这种情况下,名为“CacheFor60Seconds”的缓存配置文件将用于 GetCustomer 操作

以下配置片段演示如何指定“CacheFor60Seconds”缓存配置文件。

<configuration>  
    <system.web>  
      <compilation debug="true" targetFramework="4.0" />  
      <caching>  
        <outputCacheSettings>  
          <outputCacheProfiles>  
            <add name="CacheFor60Seconds" duration="60" varyByParam="format" varyByHeader="Accept" />  
          </outputCacheProfiles>  
        </outputCacheSettings>  
      </caching>  
    </system.web>  
</configuration>  

注解

有关可以使用输出缓存配置文件进行的设置类型的详细信息,请参阅ASP.NET 缓存设置

构造函数

名称 说明
AspNetCacheProfileAttribute(String)

使用指定的缓存配置文件名称初始化类的新实例 AspNetCacheProfileAttribute

属性

名称 说明
CacheProfileName

获取缓存配置文件的名称。

TypeId

在派生类中实现时,获取此 Attribute的唯一标识符。

(继承自 Attribute)

方法

名称 说明
AddBindingParameters(OperationDescription, BindingParameterCollection)

AddBindingParameters(OperationDescription, BindingParameterCollection)实现。 由 WCF 基础结构使用,不供开发人员使用。

ApplyClientBehavior(OperationDescription, ClientOperation)

方法的 ApplyClientBehavior(OperationDescription, ClientOperation) 实现。 由 WCF 基础结构使用,不供开发人员使用。

ApplyDispatchBehavior(OperationDescription, DispatchOperation)

方法的 ApplyDispatchBehavior(OperationDescription, DispatchOperation) 实现。 由 WCF 基础结构使用,不供开发人员使用。

Equals(Object)

返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
GetHashCode()

返回此实例的哈希代码。

(继承自 Attribute)
GetType()

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否为派生类的默认值。

(继承自 Attribute)
Match(Object)

在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)
Validate(OperationDescription)

方法的 Validate(OperationDescription) 实现。 由 WCF 基础结构使用,不供开发人员使用。

显式接口实现

名称 说明
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,该信息可用于获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对对象公开的属性和方法的访问。

(继承自 Attribute)

适用于