ConnectionProviderAttribute 建構函式

定義

初始化 ConnectionProviderAttribute 類別的新執行個體,指定要用於連接點顯示名稱的值,以及選擇性地指定要用於連接點的 ID、連接點類型或這兩者的值。

多載

ConnectionProviderAttribute(String)

初始化 ConnectionProviderAttribute 類別的新執行個體,並指定提供者連接點的顯示名稱。

ConnectionProviderAttribute(String, String)

初始化 ConnectionProviderAttribute 類別的新執行個體,並指定提供者連接點的顯示名稱和 ID。

ConnectionProviderAttribute(String, Type)

初始化 ConnectionProviderAttribute 類別的新執行個體,並指定要用於提供者連接點的顯示名稱和連接點物件的特定型別。

ConnectionProviderAttribute(String, String, Type)

ConnectionProviderAttribute 類別的新執行個體初始化,指定要用於提供者連接點的顯示名稱、識別碼和特定類型的連接點物件。

備註

提供者控制項可以有多個以中繼資料專案標記 ConnectionProviderAttribute 的方法。 在此情況下,提供者會有多個連接點,而且元素的每個實例 ConnectionProviderAttribute 都應該為相關聯的連接點指定唯一的識別碼值,以便辨別提供者的連接點。

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) 中顯示的提供者接點易記名稱。

例外狀況

displayNamenull

範例

下列程式碼範例示範如何使用 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) 中顯示的提供者接點易記名稱。

id
String

ID,為指派給提供者連接點的唯一字串值。

例外狀況

displayNameidnull

備註

參數 displayName 是提供者連接點的易記名稱,由控制項用來 ConnectionsZone 表示 UI 中的提供者連接點。

參數 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

衍生自 ConnectionPointType,且您想要加以指定為搭配特定回呼方法使用的連接點物件類型。

例外狀況

displayNameconnectionPointTypenull

connectionPointType 無效。

備註

參數 displayName 是提供者連接點的易記名稱,由控制項用來 ConnectionsZone 表示 UI 中的提供者連接點。

參數 connectionPointType 必須是 Type 衍生自 ProviderConnectionPoint 的 。 如果指定此參數, Type 則會用來建立連接點,而不是 Web 元件控制項集所提供的標準 ProviderConnectionPoint 類別。

另請參閱

適用於

ConnectionProviderAttribute(String, String, Type)

ConnectionProviderAttribute 類別的新執行個體初始化,指定要用於提供者連接點的顯示名稱、識別碼和特定類型的連接點物件。

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) 中顯示的提供者接點易記名稱。

id
String

ID,為指派給提供者連接點的唯一字串值。

connectionPointType
Type

衍生自 ProviderConnectionPointType,且您想要加以指定為搭配特定回呼方法使用的連接點物件類型。

例外狀況

displayNameidconnectionPointTypenull

connectionPointType 無效。

備註

參數 displayName 是提供者連接點的易記名稱,由控制項用來 ConnectionsZone 表示 UI 中的提供者連接點。

參數 id 是用來指定與特定回呼方法相關聯的提供者連接點識別碼。 控制項可以有多個連接點,但 id 每個的 必須是唯一的。 因此,如果您在提供者控制項中有多個回呼方法,這個建構函式的多載會很有用。

參數 connectionPointType 必須是 Type 衍生自 ProviderConnectionPoint 的 。 如果指定此參數, Type 則會用來建立連接點,而不是 Web 元件控制項集所提供的標準 ProviderConnectionPoint 類別。

另請參閱

適用於