語言

ConnectionConsumerAttribute 建構函式

定義

初始化類別的新實例 ConnectionConsumerAttribute ,指定連接點顯示名稱的值,並可選擇指定連接點的 ID、連接點類型或兩者的值。

多載

名稱 Description
ConnectionConsumerAttribute(String)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定消費者連接點的顯示名稱。

ConnectionConsumerAttribute(String, String)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定使用者連接點的顯示名稱與 ID。

ConnectionConsumerAttribute(String, Type)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定顯示名稱及特定類型的連接點物件作為消費者連接點。

ConnectionConsumerAttribute(String, String, Type)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定顯示名稱、ID 及用於消費者連接點的特定連接點物件類型。

備註

消費者控制裝置可以有多個以元 ConnectionConsumerAttribute 資料元素標記的方法。 在這種情況下,消費者會有多個連接點,且每個元素實例 ConnectionConsumerAttribute 應指定該連接點的唯一 ID 值,以便區分消費者的連接點。

ConnectionConsumerAttribute(String)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定消費者連接點的顯示名稱。

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)中顯示。

例外狀況

displayName 是 null。

範例

以下程式碼範例示範如何使用該 ConnectionConsumerAttribute 類別,說明如何在消費者控制中對回調方法宣告 ConnectionConsumerAttribute 元資料元素。 請注意,使用最簡單的建構子超載;僅 displayName 提供參數值。 關於執行該程式碼範例所需的完整程式碼,請參閱 ConnectionConsumerAttribute 課程概述。

[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 Parts 控制項的方法作為消費者使用。 此方法成為提供者與消費者之間的連結點。 通常,使用這個建構子的方式是宣告 ConnectionConsumerAttribute 一個你想在消費者控制中指定為回調方法的方法上的元資料元素。

參數 displayName 是消費者連接點的友善名稱,控制項用 ConnectionsZone 來代表使用者在使用者介面中的連接點。

另請參閱

適用於

ConnectionConsumerAttribute(String, String)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定使用者連接點的顯示名稱與 ID。

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)中顯示。

id
String

該 ID,為分配給消費者連接點的唯一字串值。

例外狀況

displayName 或 id 為 null。

備註

參數 displayName 是消費者連接點的友善名稱,控制項用 ConnectionsZone 來代表使用者在使用者介面中的連接點。

該 id 參數用來指定與特定回撥方法相關的消費者連接點的 ID。 一個控制點可以有多個連接點,但 id 每個的連接點必須是唯一的。 因此,當你的消費者控制多種回調方法時,這種建構子的過載非常有用。

另請參閱

適用於

ConnectionConsumerAttribute(String, Type)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定顯示名稱及特定類型的連接點物件作為消費者連接點。

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)中顯示。

connectionPointType
Type

A Type 源自 ConsumerConnectionPoint,你想指定為要用特定回調方法使用的連接點物件類型。

例外狀況

displayName 或 connectionPointType 為 null。

connectionPointType 不成立。

備註

參數 displayName 是消費者連接點的友善名稱,控制項用 ConnectionsZone 來代表使用者在使用者介面中的連接點。

參數 connectionPointType 必須是 Type 從 ConsumerConnectionPoint導出的。 若指定此參數,則使用 以 Type 建立連接點,而非 Web Parts 控制集提供的標準 ConsumerConnectionPoint 類別。

另請參閱

適用於

ConnectionConsumerAttribute(String, String, Type)

初始化該類別的新實例 ConnectionConsumerAttribute ,指定顯示名稱、ID 及用於消費者連接點的特定連接點物件類型。

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)中顯示。

id
String

該 ID,為分配給消費者連接點的唯一字串值。

connectionPointType
Type

A Type 源自 ConsumerConnectionPoint,你想指定為要用特定回調方法使用的連接點物件類型。

例外狀況

displayName, , id或 connectionPointType 是 null。

connectionPointType 不成立。

備註

參數 displayName 是消費者連接點的友善名稱,控制項用 ConnectionsZone 來代表使用者在使用者介面中的連接點。

該 id 參數用來指定與特定回撥方法相關的消費者連接點的 ID。 一個控制點可以有多個連接點,但 id 每個的連接點必須是唯一的。 因此,當你的消費者控制多種回調方法時,這種建構子的過載非常有用。

參數 connectionPointType 必須是 Type 從 ConsumerConnectionPoint導出的。 若指定此參數,則使用 以 Type 建立連接點,而非 Web Parts 控制集提供的標準 ConsumerConnectionPoint 類別。

另請參閱

適用於