ConnectionProviderAttribute 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化類別的新實例 ConnectionProviderAttribute ,指定連接點顯示名稱的值,並可選擇指定連接點的 ID、連接點類型或兩者的值。
多載
| 名稱 | Description |
|---|---|
| ConnectionProviderAttribute(String) |
初始化該類別的新實例 ConnectionProviderAttribute ,指定提供者連接點的顯示名稱。 |
| ConnectionProviderAttribute(String, String) |
初始化該類別的新實例 ConnectionProviderAttribute ,指定顯示名稱與提供者連接點的識別碼。 |
| 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 Parts 控制項的方法作為提供者使用。 此方法成為提供者與消費者之間的連結點。 通常,使用此建構子的方式是在你想指定為提供者控制中回調方法的方法上宣告一個 ConnectionProviderAttribute 元資料元素。
參數 displayName 是提供者連接點的友好名稱,控制項用 ConnectionsZone 來代表使用者介面中提供者的連接點。
另請參閱
適用於
ConnectionProviderAttribute(String, String)
初始化該類別的新實例 ConnectionProviderAttribute ,指定顯示名稱與提供者連接點的識別碼。
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 來代表使用者介面中提供者的連接點。
該 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
A Type 源自 ConnectionPoint,你想指定為要用特定回調方法使用的連接點物件類型。
例外狀況
displayName 或 connectionPointType 為 null。
connectionPointType 不成立。
備註
參數 displayName 是提供者連接點的友好名稱,控制項用 ConnectionsZone 來代表使用者介面中提供者的連接點。
參數 connectionPointType 必須是 Type 從 ProviderConnectionPoint導出的。 若指定此參數,則使用 以 Type 建立連接點,而非 Web Parts 控制集提供的標準 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
A Type 源自 ProviderConnectionPoint,你想指定為要用特定回調方法使用的連接點物件類型。
例外狀況
displayName, , id或 connectionPointType 是 null。
connectionPointType 不成立。
備註
參數 displayName 是提供者連接點的友好名稱,控制項用 ConnectionsZone 來代表使用者介面中提供者的連接點。
該 id 參數用來指定與特定回撥方法相關的提供者連接點的識別碼。 一個控制點可以有多個連接點,但 id 每個的連接點必須是唯一的。 因此,當你的提供者控制中有多重回調方法時,這種建構子過載非常有用。
參數 connectionPointType 必須是 Type 從 ProviderConnectionPoint導出的。 若指定此參數,則使用 以 Type 建立連接點,而非 Web Parts 控制集提供的標準 ProviderConnectionPoint 類別。