ConnectionPoint.AllowsMultipleConnections プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ConnectionPoint.AllowsMultipleConnections プロパティの意味・解説 

ConnectionPoint.AllowsMultipleConnections プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

コネクション ポイント同時に複数接続サポートするかどうかを示す値を取得します

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public ReadOnly Property
 AllowsMultipleConnections As Boolean
Dim instance As ConnectionPoint
Dim value As Boolean

value = instance.AllowsMultipleConnections
public bool AllowsMultipleConnections { get;
 }
public:
property bool AllowsMultipleConnections {
    bool get ();
}
/** @property */
public boolean get_AllowsMultipleConnections ()
public function get AllowsMultipleConnections
 () : boolean

プロパティ
コネクション ポイント複数接続サポートする場合trueそれ以外場合false

解説解説

ProviderConnectionPoint オブジェクトAllowsMultipleConnections プロパティ値は、(ConnectionProviderAttribute クラスによって) true設定されています。これは、既定では、Web パーツ コントロール セットプロバイダ コネクション ポイント複数コンシューマへの接続構成できるように設定されているからです。

対照的に、ConsumerConnectionPoint オブジェクトAllowsMultipleConnections プロパティ値は、(ConnectionConsumerAttribute クラスによって) false設定されています。これは、既定では、Web パーツ コントロールコンシューマ接続ポイント一度1 つだけプロバイダへの接続確立できるように設定されているからです。

複数接続に関する既定動作は、接続属性使用される 2 つAttribute クラスで ConnectionProviderAttribute.AllowsMultipleConnections プロパティ (プロバイダ場合) または ConnectionConsumerAttribute.AllowsMultipleConnections プロパティ (コンシューマ場合) に別の値を割り当てることによって変更できますコンシューマ接続ポイント同時に複数プロバイダ接続できるようにする場合は、その結果生じ同期問題コード対処する必要があります

使用例使用例

ProviderConnectionPoint オブジェクトConsumerConnectionPoint オブジェクト両方AllowsMultipleConnections プロパティ使用するコード例次に示します。このコード例は、このプロパティアクセスするためのコードを含む Web ページだけを示してます。例の実行必要なコード全体については、ConnectionPoint クラス概要の「使用例」を参照してください

Web ページButton2_Click メソッドコードは、それぞれのコネクション ポイント オブジェクトAllowsMultipleConnections プロパティアクセスし、その値をラベル書き込みますブラウザページ読み込んだ後、[Connection Point Details] ボタンクリックしてコード実行します

<%@ Page Language="VB" %>
<%@ register tagprefix="uc1" 
    tagname="DisplayModeMenuVB"
    src="~/displaymodemenuvb.ascx" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.VB.Controls"
 %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Protected Sub Button1_Click(ByVal
 sender As Object, _
    ByVal e As System.EventArgs)

    Dim provPoint As ProviderConnectionPoint
 = _
      mgr.GetProviderConnectionPoints(zip1)("ZipCodeProvider")
    Dim connPoint As ConsumerConnectionPoint
 = _
      mgr.GetConsumerConnectionPoints(weather1)("ZipCodeConsumer")

    If mgr.CanConnectWebParts(zip1, provPoint, weather1, connPoint)
 Then
      mgr.ConnectWebParts(zip1, provPoint, weather1, connPoint)
    End If
    
  End Sub
  
  Protected Sub Button2_Click(ByVal
 sender As Object, _
    ByVal e As System.EventArgs)
    
    Dim conn As WebPartConnection = mgr.Connections(0)

    lblConn.Text = "<h2>Connection Point Details</h2>"
 & _
      "<h3>Provider Connection Point</h3>"
 & _
      "  Display name: " & conn.ProviderConnectionPoint.DisplayName
 & _
      "<br />" & _
      "  ID: " & conn.ProviderConnectionPoint.ID
 & _
      "<br />" & _
      "  Interface type: " & conn.ProviderConnectionPoint.InterfaceType.ToString()
 & _
      "<br />" & _
      "  Control type: " & conn.ProviderConnectionPoint.ControlType.ToString()
 & _
      "<br />" & _
      "  Allows multiple connections: " & _
        conn.ProviderConnectionPoint.AllowsMultipleConnections.ToString() & _
      "<br />" & _
      "  Enabled: " & conn.ProviderConnectionPoint.GetEnabled(zip1).ToString()
 & _
      "<hr />" & _
      "<h3>Consumer Connection Point</h3>"
 & _
      "  Display name: " & conn.ConsumerConnectionPoint.DisplayName
 & _
      "<br />" & _
      "  ID: " & conn.ConsumerConnectionPoint.ID
 & _
      "<br />" & _
      "  Interface type: " & conn.ConsumerConnectionPoint.InterfaceType.ToString()
 & _
      "<br />" & _
      "  Control type: " & conn.ConsumerConnectionPoint.ControlType.ToString()
 & _
      "<br />" & _
      "  Allows multiple connections: " & _
        conn.ConsumerConnectionPoint.AllowsMultipleConnections.ToString() & _
      "<br />" & _
      "  Enabled: " & conn.ConsumerConnectionPoint.GetEnabled(zip1).ToString()
          
  End Sub

  Protected Sub Page_Load(ByVal
 sender As Object, _
    ByVal e As System.EventArgs)
    lblConn.Text = String.Empty
  End Sub
  
</script>

<html  >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:WebPartManager ID="mgr" runat="server"
 >
        <StaticConnections>
          <asp:WebPartConnection ID="conn1"
            ConsumerConnectionPointID="ZipCodeConsumer"
            ConsumerID="weather1" 
            ProviderConnectionPointID="ZipCodeProvider"
 
            ProviderID="zip1" />
        </StaticConnections>      
      </asp:WebPartManager>
      <uc1:displaymodemenuvb id="menu1" runat="server"
 />
      <asp:WebPartZone ID="WebPartZone1" runat="server">
        <ZoneTemplate>
          <aspSample:ZipCodeWebPart ID="zip1" runat="server"
            Title="Zip Code Provider"  />
          <aspSample:WeatherWebPart ID="weather1"
 runat="server" 
            Title="Zip Code Consumer" />
        </ZoneTemplate>
      </asp:WebPartZone>
      <asp:ConnectionsZone ID="ConnectionsZone1"
 runat="server">
      </asp:ConnectionsZone>
      <asp:Button ID="Button1" runat="server"
 
        Text="Dynamic Connection" 
        OnClick="Button1_Click" />      
      <br />
      <asp:Button ID="Button2" runat="server"
 
        Text="Connection Point Details" 
        OnClick="Button2_Click" />
      <br />
      <asp:Label ID="lblConn" runat="server"
 />
    </div>
    </form>
</body>
</html>
<%@ Page Language="C#" %>
<%@ register tagprefix="uc1" 
    tagname="DisplayModeMenuCS"
    src="~/displaymodemenucs.ascx" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.CS.Controls" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  protected void Button1_Click(object sender,
 EventArgs e)
  {
    ProviderConnectionPoint provPoint =
      mgr.GetProviderConnectionPoints(zip1)["ZipCodeProvider"];
    ConsumerConnectionPoint connPoint =
      mgr.GetConsumerConnectionPoints(weather1)["ZipCodeConsumer"];
      
    if(mgr.CanConnectWebParts(zip1, provPoint, weather1, connPoint))
      mgr.ConnectWebParts(zip1, provPoint, weather1, connPoint);
  
  }  
  protected void Button2_Click(object sender,
 EventArgs e)
  {
    WebPartConnection conn = mgr.Connections[0];
    
    lblConn.Text = "<h2>Connection Point Details</h2>" + 
       "<h3>Provider Connection Point</h3>" + 
       "  Display name: " + conn.ProviderConnectionPoint.DisplayName +
 
       "<br />" + 
       "  ID: " + conn.ProviderConnectionPoint.ID + 
       "<br />" + 
       "  Interface type: " + 
        conn.ProviderConnectionPoint.InterfaceType.ToString() + 
       "<br />" + 
       "  Control type: " + conn.ProviderConnectionPoint.ControlType.ToString()
 + 
       "<br />" + 
       "  Allows multiple connections: " + 
          conn.ProviderConnectionPoint.AllowsMultipleConnections.ToString() + 
       "<br />" + 
       "  Enabled: " + conn.ProviderConnectionPoint.GetEnabled(zip1).ToString()
 + 
       "<hr />" + 
       "<h3>Consumer Connection Point</h3>" + 
       "  Display name: " + conn.ConsumerConnectionPoint.DisplayName +
 
       "<br />" + 
       "  ID: " + conn.ConsumerConnectionPoint.ID + 
       "<br />" + 
       "  Interface type: " + conn.ConsumerConnectionPoint.InterfaceType.ToString()
 + 
       "<br />" + 
       "  Control type: " + conn.ConsumerConnectionPoint.ControlType.ToString()
 + 
       "<br />" + 
       "  Allows multiple connections: " + 
          conn.ConsumerConnectionPoint.AllowsMultipleConnections.ToString() + 
       "<br />" + 
       "  Enabled: " + conn.ConsumerConnectionPoint.GetEnabled(zip1).ToString();
  }

  protected void Page_Load(object sender, EventArgs
 e)
  {
    lblConn.Text = String.Empty;
  }
</script>

<html  >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:WebPartManager ID="mgr" runat="server" >
        <StaticConnections>
          <asp:WebPartConnection ID="conn1"
            ConsumerConnectionPointID="ZipCodeConsumer"
            ConsumerID="weather1" 
            ProviderConnectionPointID="ZipCodeProvider" 
            ProviderID="zip1" />
        </StaticConnections>      
      </asp:WebPartManager>
      <uc1:displaymodemenucs id="menu1" runat="server" />
      <asp:WebPartZone ID="WebPartZone1" runat="server">
        <ZoneTemplate>
          <aspSample:ZipCodeWebPart ID="zip1" runat="server"
            Title="Zip Code Provider"  />
          <aspSample:WeatherWebPart ID="weather1" runat="server"
 
            Title="Zip Code Consumer" />
        </ZoneTemplate>
      </asp:WebPartZone>
      <asp:ConnectionsZone ID="ConnectionsZone1" runat="server">
      </asp:ConnectionsZone>
      <asp:Button ID="Button1" runat="server" 
        Text="Dynamic Connection" 
        OnClick="Button1_Click" />      
      <br />
      <asp:Button ID="Button2" runat="server" 
        Text="Connection Point Details" 
        OnClick="Button2_Click" />
      <br />
      <asp:Label ID="lblConn" runat="server" />
    </div>
    </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConnectionPoint クラス
ConnectionPoint メンバ
System.Web.UI.WebControls.WebParts 名前空間
ConnectionProviderAttribute
ConnectionConsumerAttribute クラス
その他の技術情報
ASP.NET Web パーツ ページ



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ConnectionPoint.AllowsMultipleConnections プロパティ」の関連用語

ConnectionPoint.AllowsMultipleConnections プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ConnectionPoint.AllowsMultipleConnections プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS