ProfileGroupBase クラス
アセンブリ: System.Web (system.web.dll 内)


現在の HttpContext に対する Profile でプロパティをグループ化するため、ProfileGroupBase クラスが ASP.NET によって使用されます。profile の properties の group 要素 (ASP.NET 設定スキーマ) を使用してプロパティがプロパティのグループとして指定されると、ASP.NET は、グループ内の各プロパティに対し、厳密に型指定されたアクセサを使用して新しいクラスを作成します。新しいクラスは、ProfileGroupBase 基本クラスを継承します。新しいクラスの厳密に型指定されたアクセサは、ProfileGroupBase 基本クラスの GetPropertyValue および SetPropertyValue の各メソッドを呼び出して、それぞれのプロファイル プロパティ値の取得と設定を行います。
ProfileGroupBase は、ProfileGroupBase クラスの Init メソッドに提供されている ProfileBase クラスを継承するクラスに対し、呼び出しの制御を渡してプロパティ値の取得と設定を行います。動作や例外などの詳細については、ProfileBase クラスを参照してください。

次の Web.config ファイルは、Address のグループ名を使用したプロパティ グループを含むユーザー プロファイルを指定します。現在の HttpContext の Profile プロパティに対して生成されたグループ化済みプロパティは、Profile.Address.Street のようなグループ名によって優先順位が決まります。ASP.NET ページが設定済みのプロファイル プロパティの格納と取得を行う例を次に示します。
<configuration> <connectionStrings> <add name="SqlServices" connectionString= "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=aspnetdb;" /> </connectionStrings> <system.web> <authentication mode="Forms" > <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" /> </authentication> <authorization> <deny users="?" /> </authorization> <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15"> <providers> <clear /> <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="SqlServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="false" passwordFormat="Hashed" applicationName="MyApplication" /> </providers> </membership> <profile enabled="true" defaultProvider="SqlProvider"> <providers> <add name="SqlProvider" connectionStringName="SqlServices" applicationName="MyApplication" type="System.Web.Profile.SqlProfileProvider" /> </providers> <properties> <add name="ZipCode" /> <group name="Address"> <add name="Street" /> <add name="City" /> <add name="State" /> <add name="CountryOrRegion" /> </group> </properties> </profile> </system.web> </configuration>
ASP.NET ページが、ユーザー プロファイルに対して指定された、グループ化されたプロパティを読み込んだり、設定したりするコード例を次に示します。
<%@ Page Language="VB" %> <script runat="server"> Public Sub Page_Load() If Not IsPostBack Then StreetTextBox.Text = Profile.Address.Street CityTextBox.Text = Profile.Address.City StateTextBox.Text = Profile.Address.State CountryOrRegionTextBox.Text = Profile.Address.CountryOrRegion ZipCodeTextBox.Text = Profile.ZipCode End If End Sub Public Sub UpdateButton_OnClick(sender As Object, args As EventArgs) Profile.Address.Street = StreetTextBox.Text Profile.Address.City = CityTextBox.Text Profile.Address.State = StateTextBox.Text Profile.Address.CountryOrRegion = CountryOrRegionTextBox.Text Profile.ZipCode = ZipCodeTextBox.Text End Sub </script> <html> <head> <title>Home Page</title> </head> <body> <h3>Address Information for <%=User.Identity.Name%></h3> <form runat="server"> <table border=1 cellpadding=2 cellspacing=2> <tr> <td>Street Address</td> <td><asp:Textbox id="StreetTextBox" runat="server" columns="30" /></td> </tr> <tr> <td>City</td> <td><asp:Textbox id="CityTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>State</td> <td><asp:Textbox id="StateTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>Zip Code</td> <td><asp:Textbox id="ZipCodeTextBox" runat="server" columns="10" /></td> </tr> <tr> <td>Country</td> <td><asp:Textbox id="CountryOrRegionTextBox" runat="server" columns="20" /></td> </tr> </table> <asp:Button id="UpdateButton" runat="server" OnClick="UpdateButton_OnClick" Text="Update Address" /> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> public void Page_Load() { if (!IsPostBack) { StreetTextBox.Text = Profile.Address.Street; CityTextBox.Text = Profile.Address.City; StateTextBox.Text = Profile.Address.State; CountryOrRegionTextBox.Text = Profile.Address.CountryOrRegion; ZipCodeTextBox.Text = Profile.ZipCode; } } public void UpdateButton_OnClick(object sender, EventArgs args) { Profile.Address.Street = StreetTextBox.Text; Profile.Address.City = CityTextBox.Text; Profile.Address.State = StateTextBox.Text; Profile.Address.CountryOrRegion = CountryOrRegionTextBox.Text; Profile.ZipCode = ZipCodeTextBox.Text; } </script> <html> <head> <title>Home Page</title> </head> <body> <h3>Address Information for <%=User.Identity.Name%></h3> <form runat="server"> <table border=1 cellpadding=2 cellspacing=2> <tr> <td>Street Address</td> <td><asp:Textbox id="StreetTextBox" runat="server" columns="30" /></td> </tr> <tr> <td>City</td> <td><asp:Textbox id="CityTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>State</td> <td><asp:Textbox id="StateTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>Zip Code</td> <td><asp:Textbox id="ZipCodeTextBox" runat="server" columns="10" /></td> </tr> <tr> <td>Country</td> <td><asp:Textbox id="CountryOrRegionTextBox" runat="server" columns="20" /></td> </tr> </table> <asp:Button id="UpdateButton" runat="server" OnClick="UpdateButton_OnClick" Text="Update Address" /> </form> </body> </html>


System.Web.Profile.ProfileGroupBase


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProfileGroupBase コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


ASP.NET はProfileGroupBase クラスを使用して、現在の HttpContext に対する Profile プロパティでプロパティをグループ化します。profile の properties の group 要素 (ASP.NET 設定スキーマ) 要素を使用してプロパティがプロパティのグループとして指定されると、ASP.NET は、グループ内の各プロパティに対し、厳密に型指定されたアクセサを使用して新しいクラスを作成します。新しいクラスは、ProfileGroupBase 基本クラスを継承します。

次の Web.config ファイルは、Address のグループ名を使用したプロパティ グループを含むユーザー プロファイルを指定します。現在の HttpContext の Profile プロパティに対して生成されたグループ化済みプロパティは、Profile.Address.Street のようなグループ名によって優先順位が決まります。
<configuration> <connectionStrings> <add name="SqlServices" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=aspnetdb;" /> </connectionStrings> <system.web> <authentication mode="Forms" > <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" /> </authentication> <authorization> <deny users="?" /> </authorization> <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15"> <providers> <clear /> <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="SqlServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="false" passwordFormat="Hashed" applicationName="MyApplication" /> </providers> </membership> <profile enabled="true" defaultProvider="SqlProvider"> <providers> <add name="SqlProvider" connectionStringName="SqlServices" applicationName="MyApplication" type="System.Web.Profile.SqlProfileProvider" /> </providers> <properties> <add name="ZipCode" /> <group name="Address"> <add name="Street" /> <add name="City" /> <add name="State" /> <add name="CountryOrRegion" /> </group> </properties> </profile> </system.web> </configuration>
次の ASP.NET ページでは、ユーザー プロファイルに対して指定された、グループ化されたプロパティを読み込んだり、設定したりします。
<%@ Page Language="VB" %> <script runat="server"> Public Sub Page_Load() If Not IsPostBack Then StreetTextBox.Text = Profile.Address.Street CityTextBox.Text = Profile.Address.City StateTextBox.Text = Profile.Address.State CountryOrRegionTextBox.Text = Profile.Address.CountryOrRegion ZipCodeTextBox.Text = Profile.ZipCode End If End Sub Public Sub UpdateButton_OnClick(sender As Object, args As EventArgs) Profile.Address.Street = StreetTextBox.Text Profile.Address.City = CityTextBox.Text Profile.Address.State = StateTextBox.Text Profile.Address.CountryOrRegion = CountryOrRegionTextBox.Text Profile.ZipCode = ZipCodeTextBox.Text End Sub </script> <html> <head> <title>Home Page</title> </head> <body> <h3>Address Information for <%=User.Identity.Name%></h3> <form runat="server"> <table border=1 cellpadding=2 cellspacing=2> <tr> <td>Street Address</td> <td><asp:Textbox id="StreetTextBox" runat="server" columns="30" /></td> </tr> <tr> <td>City</td> <td><asp:Textbox id="CityTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>State</td> <td><asp:Textbox id="StateTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>Zip Code</td> <td><asp:Textbox id="ZipCodeTextBox" runat="server" columns="10" /></td> </tr> <tr> <td>Country</td> <td><asp:Textbox id="CountryOrRegionTextBox" runat="server" columns="20" /></td> </tr> </table> <asp:Button id="UpdateButton" runat="server" OnClick="UpdateButton_OnClick" Text="Update Address" /> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> public void Page_Load() { if (!IsPostBack) { StreetTextBox.Text = Profile.Address.Street; CityTextBox.Text = Profile.Address.City; StateTextBox.Text = Profile.Address.State; CountryOrRegionTextBox.Text = Profile.Address.CountryOrRegion; ZipCodeTextBox.Text = Profile.ZipCode; } } public void UpdateButton_OnClick(object sender, EventArgs args) { Profile.Address.Street = StreetTextBox.Text; Profile.Address.City = CityTextBox.Text; Profile.Address.State = StateTextBox.Text; Profile.Address.CountryOrRegion = CountryOrRegionTextBox.Text; Profile.ZipCode = ZipCodeTextBox.Text; } </script> <html> <head> <title>Home Page</title> </head> <body> <h3>Address Information for <%=User.Identity.Name%></h3> <form runat="server"> <table border=1 cellpadding=2 cellspacing=2> <tr> <td>Street Address</td> <td><asp:Textbox id="StreetTextBox" runat="server" columns="30" /></td> </tr> <tr> <td>City</td> <td><asp:Textbox id="CityTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>State</td> <td><asp:Textbox id="StateTextBox" runat="server" columns="20" /></td> </tr> <tr> <td>Zip Code</td> <td><asp:Textbox id="ZipCodeTextBox" runat="server" columns="10" /></td> </tr> <tr> <td>Country</td> <td><asp:Textbox id="CountryOrRegionTextBox" runat="server" columns="20" /></td> </tr> </table> <asp:Button id="UpdateButton" runat="server" OnClick="UpdateButton_OnClick" Text="Update Address" /> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProfileGroupBase プロパティ
ProfileGroupBase メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetPropertyValue | グループ化されたプロファイル プロパティの値を取得します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | Init | グループ化されたプロファイル プロパティ値と情報を初期化するため、ASP.NET によって使用されます。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | SetPropertyValue | グループ化されたプロファイル プロパティの値を設定します。 |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

ProfileGroupBase メンバ
ASP.NET プロファイル プロパティ値をグループ化するための、型指定しないアクセスを提供します。
ProfileGroupBase データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetPropertyValue | グループ化されたプロファイル プロパティの値を取得します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | Init | グループ化されたプロファイル プロパティ値と情報を初期化するため、ASP.NET によって使用されます。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | SetPropertyValue | グループ化されたプロファイル プロパティの値を設定します。 |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- ProfileGroupBaseのページへのリンク