Context.RegisterDynamicProperty(IDynamicProperty, ContextBoundObject, Context) Context.RegisterDynamicProperty(IDynamicProperty, ContextBoundObject, Context) Context.RegisterDynamicProperty(IDynamicProperty, ContextBoundObject, Context) Context.RegisterDynamicProperty(IDynamicProperty, ContextBoundObject, Context) Method

定义

用远程处理服务注册实现 IDynamicProperty 接口的动态属性。Registers a dynamic property implementing the IDynamicProperty interface with the remoting service.

此 API 支持产品基础结构,不能在代码中直接使用。

public:
 static bool RegisterDynamicProperty(System::Runtime::Remoting::Contexts::IDynamicProperty ^ prop, ContextBoundObject ^ obj, System::Runtime::Remoting::Contexts::Context ^ ctx);
public static bool RegisterDynamicProperty (System.Runtime.Remoting.Contexts.IDynamicProperty prop, ContextBoundObject obj, System.Runtime.Remoting.Contexts.Context ctx);
static member RegisterDynamicProperty : System.Runtime.Remoting.Contexts.IDynamicProperty * ContextBoundObject * System.Runtime.Remoting.Contexts.Context -> bool
Public Shared Function RegisterDynamicProperty (prop As IDynamicProperty, obj As ContextBoundObject, ctx As Context) As Boolean

参数

prop
IDynamicProperty IDynamicProperty IDynamicProperty IDynamicProperty

要注册的动态属性。The dynamic property to register.

obj
ContextBoundObject ContextBoundObject ContextBoundObject ContextBoundObject

为其注册 property 的对象/代理。The object/proxy for which the property is registered.

ctx
Context Context Context Context

为其注册 property 的上下文。The context for which the property is registered.

返回

如果该属性已成功注册,则为 true;否则为 falsetrue if the property was successfully registered; otherwise, false.

异常

要么 prop 或其名称为 null,要么它不是动态的(不实现 IDynamicProperty)。Either prop or its name is null, or it is not dynamic (it does not implement IDynamicProperty).

对象和上下文都已指定(objctx 都不为 null)。Both an object as well as a context are specified (both obj and ctx are not null).

注解

obj根据和ctx,要求提供一个接收器,将其放置在远程调用路径中的某个位置。propBased on obj and ctx, prop is asked to contribute a sink that is placed at some location in the path of remoting calls. 如果注册了多个属性, 则将按任意顺序调用其接收器, 以便在调用之间进行更改。If multiple properties are registered, their sinks will be called in an arbitrary order that can change between calls.

如果objnull是, 则在代理上进行的所有调用都将被截取。If obj is not null, and then if it is a proxy, all calls made on the proxy are intercepted. 否则, 如果obj是实际对象, 则会截获对该对象的所有调用。Otherwise, if obj is a real object, all calls on the object are intercepted. 参数必须是nullctxThe ctx parameter must be null.

如果ctxnullnull ,obj则必须为, 并且所有进入和退出上下文的调用都将被截取。If ctx is not null, obj must be null and all calls entering and leaving the context are intercepted.

ctx如果和obj都是null, 则会截获进入和退出所有上下文的所有调用。If both ctx and obj are null, all calls entering and leaving all contexts are intercepted.

安全性

SecurityPermission
用于将代码插入到 CLR 基础结构中。for plugging code into the CLR infrastructure. 关联枚举:InfrastructureAssociated enumeration: Infrastructure.

适用于