ConnectionProviderAttribute 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化类的新实例 ConnectionProviderAttribute ,指定要用于连接点显示名称的值,并根据需要指定要用于连接点 ID、连接点类型或两者的值。
重载
| 名称 | 说明 |
|---|---|
| ConnectionProviderAttribute(String) |
初始化类的新实例 ConnectionProviderAttribute ,指定提供程序连接点的显示名称。 |
| ConnectionProviderAttribute(String, String) |
初始化类的新实例 ConnectionProviderAttribute ,指定提供程序连接点的显示名称和 ID。 |
| ConnectionProviderAttribute(String, Type) |
初始化类的新实例 ConnectionProviderAttribute ,指定用于提供程序连接点的显示名称和特定类型的连接点对象。 |
| ConnectionProviderAttribute(String, String, Type) |
初始化类的新实例 ConnectionProviderAttribute ,指定用于提供程序连接点的显示名称、ID 和特定类型的连接点对象。 |
注解
提供程序控件可以有多个用 ConnectionProviderAttribute 元数据元素标记的方法。 在这种情况下,提供程序将有多个连接点,并且元素的每个实例 ConnectionProviderAttribute 应为关联的连接点指定唯一的 ID 值,以便可以区分提供程序的连接点。
ConnectionProviderAttribute(String)
初始化类的新实例 ConnectionProviderAttribute ,指定提供程序连接点的显示名称。
public:
ConnectionProviderAttribute(System::String ^ displayName);
public ConnectionProviderAttribute(string displayName);
new System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute : string -> System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute
Public Sub New (displayName As String)
参数
- displayName
- String
一个字符串,其中包含提供程序连接点的友好名称,以便在用户界面(UI)中显示。
例外
displayName 是 null。
示例
下面的代码示例演示如何使用 ConnectionProviderAttribute 类,演示如何在提供程序控件中的回调方法上声明 ConnectionProviderAttribute 元数据元素。 请注意,使用构造函数的最简单重载; displayName 仅提供参数值。 有关运行代码示例所需的完整代码,请参阅 ConnectionProviderAttribute 类概述。
[ConnectionProvider("Row")]
public IWebPartRow GetConnectionInterface()
{
return new RowProviderWebPart();
}
<ConnectionProvider("Row")> _
Public Function GetConnectionInterface() As IWebPartRow
Return New RowProviderWebPart()
End Function 'GetConnectionInterface
注解
此构造函数创建一个特性的实例,该实例与充当提供程序的 Web 部件控件的方法一起使用。 此方法将成为提供程序与使用者之间的连接点。 通常,使用此构造函数的方式是在要指定为提供程序控件中的回调方法的方法上声明 ConnectionProviderAttribute 元数据元素。
参数 displayName 是提供程序连接点的友好名称,由控件用来 ConnectionsZone 表示 UI 中的提供程序连接点。
另请参阅
适用于
ConnectionProviderAttribute(String, String)
初始化类的新实例 ConnectionProviderAttribute ,指定提供程序连接点的显示名称和 ID。
public:
ConnectionProviderAttribute(System::String ^ displayName, System::String ^ id);
public ConnectionProviderAttribute(string displayName, string id);
new System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute : string * string -> System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute
Public Sub New (displayName As String, id As String)
参数
- displayName
- String
一个字符串,其中包含提供程序连接点的友好名称,以便在用户界面(UI)中显示。
例外
displayName 或 id 为 null.
注解
参数 displayName 是提供程序连接点的友好名称,由控件用来 ConnectionsZone 表示 UI 中的提供程序连接点。
该 id 参数用于指定与特定回调方法关联的提供程序连接点的 ID。 控件可以有多个连接点,但 id 每个连接点必须是唯一的。 因此,如果在提供程序控件中有多个回调方法,则构造函数的此重载非常有用。
另请参阅
适用于
ConnectionProviderAttribute(String, Type)
初始化类的新实例 ConnectionProviderAttribute ,指定用于提供程序连接点的显示名称和特定类型的连接点对象。
public:
ConnectionProviderAttribute(System::String ^ displayName, Type ^ connectionPointType);
public ConnectionProviderAttribute(string displayName, Type connectionPointType);
new System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute : string * Type -> System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute
Public Sub New (displayName As String, connectionPointType As Type)
参数
- displayName
- String
一个字符串,其中包含提供程序连接点的友好名称,以便在用户界面(UI)中显示。
- connectionPointType
- Type
Type派生自ConnectionPoint的,并且你想要指定为要用于特定回调方法的连接点对象的类型。
例外
displayName 或 connectionPointType 为 null.
connectionPointType 无效。
注解
参数 displayName 是提供程序连接点的友好名称,由控件用来 ConnectionsZone 表示 UI 中的提供程序连接点。
参数 connectionPointType 必须是 Type 派生自 ProviderConnectionPoint. 如果指定此参数, Type 则用于创建连接点,而不是 Web 部件控件集提供的标准 ProviderConnectionPoint 类。
另请参阅
适用于
ConnectionProviderAttribute(String, String, Type)
初始化类的新实例 ConnectionProviderAttribute ,指定用于提供程序连接点的显示名称、ID 和特定类型的连接点对象。
public:
ConnectionProviderAttribute(System::String ^ displayName, System::String ^ id, Type ^ connectionPointType);
public ConnectionProviderAttribute(string displayName, string id, Type connectionPointType);
new System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute : string * string * Type -> System.Web.UI.WebControls.WebParts.ConnectionProviderAttribute
Public Sub New (displayName As String, id As String, connectionPointType As Type)
参数
- displayName
- String
一个字符串,其中包含提供程序连接点的友好名称,以便在用户界面(UI)中显示。
- connectionPointType
- Type
Type派生自ProviderConnectionPoint的,并且你想要指定为要用于特定回调方法的连接点对象的类型。
例外
displayName, id或 connectionPointType 为 null。
connectionPointType 无效。
注解
参数 displayName 是提供程序连接点的友好名称,由控件用来 ConnectionsZone 表示 UI 中的提供程序连接点。
该 id 参数用于指定与特定回调方法关联的提供程序连接点的 ID。 控件可以有多个连接点,但 id 每个连接点必须是唯一的。 因此,如果在提供程序控件中有多个回调方法,则构造函数的此重载非常有用。
参数 connectionPointType 必须是 Type 派生自 ProviderConnectionPoint. 如果指定此参数, Type 则用于创建连接点,而不是 Web 部件控件集提供的标准 ProviderConnectionPoint 类。