ConnectionConsumerAttribute 构造函数

定义

初始化 ConnectionConsumerAttribute 类的新实例,指定一个值用作连接点显示名称,还可以选择指定一些值用作连接点的 ID 和/或连接点类型。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a value to use for the connection point display name, and optionally specifying values to use for the connection point's ID, the connection point type, or both.

重载

ConnectionConsumerAttribute(String)

初始化 ConnectionConsumerAttribute 类的新实例,为使用者连接点指定显示名称。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name for the consumer connection point.

ConnectionConsumerAttribute(String, String)

初始化 ConnectionConsumerAttribute 类的新实例,为使用者连接点指定显示名称和 ID。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and an ID for the consumer connection point.

ConnectionConsumerAttribute(String, Type)

初始化 ConnectionConsumerAttribute 类的新实例,指定使用者连接点所使用的显示名称和特定连接点对象类型。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and a specific type of connection point object to use for the consumer connection point.

ConnectionConsumerAttribute(String, String, Type)

初始化 ConnectionConsumerAttribute 类的新实例,指定显示名称、ID 以及用于使用者连接点的连接点对象的特定类型。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name, an ID, and a specific type of connection point object to use for the consumer connection point.

注解

使用者控件可以有多个用 metadata 元素标记的方法 ConnectionConsumerAttributeA consumer control can have multiple methods marked with the ConnectionConsumerAttribute metadata element. 在这种情况下,使用者将具有多个连接点,并且元素的每个实例 ConnectionConsumerAttribute 都应为关联的连接点指定一个唯一的 ID 值,以便可以区分使用者的连接点。In this case, the consumer would have multiple connection points, and each instance of the ConnectionConsumerAttribute element should specify a unique ID value for the associated connection point, so that the consumer's connection points can be distinguished.

ConnectionConsumerAttribute(String)

初始化 ConnectionConsumerAttribute 类的新实例,为使用者连接点指定显示名称。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName);
public ConnectionConsumerAttribute (string displayName);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String)

参数

displayName
String

一个字符串,该字符串包含使用者连接点在用户界面 (UI) 中显示的友好名称。A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

例外

displayNamenulldisplayName is null.

示例

下面的代码示例演示如何使用 ConnectionConsumerAttribute 类,方法是说明如何 ConnectionConsumerAttribute 在使用者控件中的回调方法上声明 metadata 元素。The following code example demonstrates using the ConnectionConsumerAttribute class, by showing how to declare the ConnectionConsumerAttribute metadata element on a callback method in a consumer control. 请注意,使用构造函数的最简单重载;仅 displayName 提供参数值。Note that the simplest overload of the constructor is used; only the displayName parameter value is supplied. 有关运行代码示例所需的完整代码,请参阅 ConnectionConsumerAttribute 类概述。For the full code required to run the code example, see the ConnectionConsumerAttribute class overview.

[ConnectionConsumer("Row")]
public void SetConnectionInterface(IWebPartRow provider) 
{
    _provider = provider;
}
    <ConnectionConsumer("Row")> _
    Public Sub SetConnectionInterface(ByVal provider As IWebPartRow)
        _provider = provider

    End Sub
End Class

注解

此构造函数创建属性的实例,该属性与作为使用者的 Web 部件控件的方法一起使用。This constructor creates an instance of the attribute that is used with a method of a Web Parts control acting as a consumer. 此方法将成为提供程序和使用者之间的连接点。This method becomes the connection point between the provider and the consumer. 通常,使用此构造函数的方式是 ConnectionConsumerAttribute 在要指定为使用者控件中的回调方法的方法上声明元数据元素。Typically, the way you use this constructor is to declare a ConnectionConsumerAttribute metadata element on a method that you want to designate as a callback method in a consumer control.

displayName参数是使用者连接点的友好名称,控件使用该连接点 ConnectionsZone 来表示 UI 中使用者的连接点。The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

另请参阅

适用于

ConnectionConsumerAttribute(String, String)

初始化 ConnectionConsumerAttribute 类的新实例,为使用者连接点指定显示名称和 ID。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and an ID for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName, System::String ^ id);
public ConnectionConsumerAttribute (string displayName, string id);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string * string -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String, id As String)

参数

displayName
String

一个字符串,该字符串包含使用者连接点在用户界面 (UI) 中显示的友好名称。A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

id
String

ID,即分配给使用者连接点的唯一字符串值。The ID, a unique string value assigned to the consumer connection point.

例外

displayNameidnulldisplayName or id is null.

注解

displayName参数是使用者连接点的友好名称,控件使用该连接点 ConnectionsZone 来表示 UI 中使用者的连接点。The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

id参数用于指定与特定回调方法关联的使用者连接点的 ID。The id parameter is used to specify the ID for the consumer connection point associated with the specific callback method. 一个控件可以有多个连接点,但 id 每个连接点必须是唯一的。A control can have multiple connection points, but the id for each must be unique. 因此,如果使用者控件中有多个回调方法,则构造函数的此重载非常有用。Therefore, this overload of the constructor is useful if you have multiple callback methods in your consumer control.

另请参阅

适用于

ConnectionConsumerAttribute(String, Type)

初始化 ConnectionConsumerAttribute 类的新实例,指定使用者连接点所使用的显示名称和特定连接点对象类型。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and a specific type of connection point object to use for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName, Type ^ connectionPointType);
public ConnectionConsumerAttribute (string displayName, Type connectionPointType);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string * Type -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String, connectionPointType As Type)

参数

displayName
String

一个字符串,该字符串包含使用者连接点在用户界面 (UI) 中显示的友好名称。A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

connectionPointType
Type

一个派生自 ConsumerConnectionPoint,且你希望将其指定为连接点对象的类型以与特定的回调方法一起使用的 TypeA Type that derives from ConsumerConnectionPoint, and that you want to specify as the type of connection point object to use with a specific callback method.

例外

displayNameconnectionPointTypenulldisplayName or connectionPointType is null.

connectionPointType 无效。connectionPointType is not valid.

注解

displayName参数是使用者连接点的友好名称,控件使用该连接点 ConnectionsZone 来表示 UI 中使用者的连接点。The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

connectionPointType参数必须是 Type 从派生的 ConsumerConnectionPointThe connectionPointType parameter must be a Type derived from ConsumerConnectionPoint. 如果指定此参数,则 Type 用于创建连接点,而不是 ConsumerConnectionPoint 与 Web 部件控件集一起提供的标准类。If this parameter is specified, the Type is used to create the connection point instead of the standard ConsumerConnectionPoint class provided with the Web Parts control set.

另请参阅

适用于

ConnectionConsumerAttribute(String, String, Type)

初始化 ConnectionConsumerAttribute 类的新实例,指定显示名称、ID 以及用于使用者连接点的连接点对象的特定类型。Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name, an ID, and a specific type of connection point object to use for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName, System::String ^ id, Type ^ connectionPointType);
public ConnectionConsumerAttribute (string displayName, string id, Type connectionPointType);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string * string * Type -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String, id As String, connectionPointType As Type)

参数

displayName
String

一个字符串,该字符串包含使用者连接点在用户界面 (UI) 中显示的友好名称。A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

id
String

ID,即分配给使用者连接点的唯一字符串值。The ID, a unique string value assigned to the consumer connection point.

connectionPointType
Type

一个派生自 ConsumerConnectionPoint,且你希望将其指定为连接点对象的类型以与特定的回调方法一起使用的 TypeA Type that derives from ConsumerConnectionPoint, and that you want to specify as the type of connection point object to use with a specific callback method.

例外

displayNameidconnectionPointTypenulldisplayName, id, or connectionPointType is null.

connectionPointType 无效。connectionPointType is not valid.

注解

displayName参数是使用者连接点的友好名称,控件使用该连接点 ConnectionsZone 来表示 UI 中使用者的连接点。The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

id参数用于指定与特定回调方法关联的使用者连接点的 ID。The id parameter is used to specify the ID for the consumer connection point associated with the specific callback method. 一个控件可以有多个连接点,但 id 每个连接点必须是唯一的。A control can have multiple connection points, but the id for each must be unique. 因此,如果使用者控件中有多个回调方法,则构造函数的此重载非常有用。Therefore, this overload of the constructor is useful if you have multiple callback methods in your consumer control.

connectionPointType参数必须是 Type 从派生的 ConsumerConnectionPointThe connectionPointType parameter must be a Type derived from ConsumerConnectionPoint. 如果指定此参数,则 Type 用于创建连接点,而不是 ConsumerConnectionPoint 与 Web 部件控件集一起提供的标准类。If this parameter is specified, the Type is used to create the connection point instead of the standard ConsumerConnectionPoint class provided with the Web Parts control set.

另请参阅

适用于