ObjectCache.Host ObjectCache.Host ObjectCache.Host ObjectCache.Host Property

定义

获取或设置对托管宿主环境的引用,该环境可用于 ObjectCache 实现并且可为 ObjectCache 实现提供宿主特定服务。Gets or sets a reference to a managed hosting environment that is available to ObjectCache implementations and that can provide host-specific services to ObjectCache implementations.

public:
 static property IServiceProvider ^ Host { IServiceProvider ^ get(); void set(IServiceProvider ^ value); };
[get: System.Security.SecurityCritical]
[set: System.Security.SecurityCritical]
public static IServiceProvider Host { get; set; }
member this.Host : IServiceProvider with get, set
Public Shared Property Host As IServiceProvider

属性值

对缓存识别托管宿主环境的引用。A reference to a cache-aware managed hosting environment.

异常

为属性分配的值为 nullThe value being assigned to the property is null.

已尝试多次设置该属性值。An attempt was made to set the property value more than one time.

注解

Host属性应以供.NET Framework.NET Framework托管环境并实现依赖于.NET Framework 的行为的缓存实现托管环境。The Host property is intended for use by .NET Framework.NET Framework host environments and by cache implementations that implement behavior that depends on the .NET Framework host environment.

下表列出了主机环境服务的可能是可从托管宿主环境,适用于套ObjectCache实现通过Host属性:The following table lists the set of host environment services that might be available from a managed hosting environment and that are available to ObjectCache implementations through the Host property:

服务Service 描述Description
IApplicationIdentifier 允许宿主环境提供所需的功能,例如标识性能计数器的缓存实现的应用程序域标识符。Lets host environments provide application domain identifiers that might be needed by a cache implementation for features such as identifying performance counters.
IFileChangeNotificationSystem 允许宿主环境提供的自定义的文件更改通知系统,而不是使用中提供.NET Framework.NET FrameworkLets host environments provide a custom file-change notification system, instead of using the one provided in the .NET Framework.NET Framework.
IMemoryCacheManager 可让缓存实现将缓存内存消耗报告给主机环境。Lets cache implementations report cache memory consumption to the host environment. 这使宿主环境可以跨多个缓存实现集中管理内存使用情况。This enables host environments to centrally manage memory consumption across multiple cache implementations.

备注

此属性的值的调用方要求不受限制的代码访问安全性权限。Callers of this property value require unrestricted code access security permissions.

安全性

Demand
为此属性的所有访问器的完全信任。for full trust for all accessors of this property. 不能由部分受信任的代码使用此属性。This property cannot be used by partially trusted code.

适用于