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

<AttributeUsageAttribute(AttributeTargets.Property)> _ Public NotInheritable Class ProfileProviderAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Property)] public sealed class ProfileProviderAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Property)] public ref class ProfileProviderAttribute sealed : public Attribute

カスタム プロファイルの実装で使用するプロパティのプロファイル プロバイダを識別するには、ProfileProviderAttribute クラスが使用されます。カスタム プロファイルの実装は ProfileBase 抽象クラスから継承したクラスであり、profile 構成要素で指定されていないユーザー プロファイルのプロパティを定義します。ユーザー プロファイルのカスタム型は、次の例に示すように、アプリケーションの Web.config ファイルにある profile 構成要素の inherits 属性を使用して指定できます。
<connectionStrings>
<add name="SqlServices" connectionString=
"Data Source=localhost;Integrated Security=SSPI;Initial Catalog=aspnetdb;" />
</connectionStrings>
<authentication mode="Forms" >
<forms loginUrl="login.aspx"
name=".ASPXFORMSAUTH" />
</authentication>
</authorization>
<profile inherits="Samples.AspNet.Profile.EmployeeProfile"
defaultProvider="SqlProvider">
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlServices"
description="SQL Profile Provider for Sample"/>
<add
name="EmployeeInfoProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlServices"
description="SQL Profile Provider for Employee Info"/>
</providers>
</properties>
</profile>
</system.web>
</configuration>

ProfileBase クラスから継承するクラスを定義して、カスタム プロファイルを作成するコード例を次に示します。カスタム プロファイルの型は、アプリケーションの Web.config ファイルにある profile 構成要素の inherits 属性を使用して指定します。
Imports System Imports System.Web.Profile Namespace Samples.AspNet.Profile Public Class EmployeeProfile Inherits ProfileBase <SettingsAllowAnonymous(False)> _ <ProfileProvider("EmployeeInfoProvider")> _ Public Property Department As String Get Return MyBase.Item("EmployeeDepartment").ToString() End Get Set MyBase.Item("EmployeeDepartment") = value End Set End Property <SettingsAllowAnonymous(False)> _ <ProfileProvider("EmployeeInfoProvider")> _ Public Property Details As EmployeeInfo Get Return CType(MyBase.Item("EmployeeInfo"), EmployeeInfo) End Get Set MyBase.Item("EmployeeInfo") = value End Set End Property End Class Public Class EmployeeInfo Public Name As String Public Address As String Public Phone As String Public EmergencyContactName As String Public EmergencyContactAddress As String Public EmergencyContactPhone As String End Class End Namespace
using System; using System.Web.Profile; namespace Samples.AspNet.Profile { public class EmployeeProfile : ProfileBase { [SettingsAllowAnonymous(false)] [ProfileProvider("EmployeeInfoProvider")] public string Department { get { return base["EmployeeDepartment"].ToString(); } set { base["EmployeeDepartment"] = value; } } [SettingsAllowAnonymous(false)] [ProfileProvider("EmployeeInfoProvider")] public EmployeeInfo Details { get { return (EmployeeInfo)base["EmployeeInfo"]; } set { base["EmployeeInfo"] = value; } } } public class EmployeeInfo { public string Name; public string Address; public string Phone; public string EmergencyContactName; public string EmergencyContactAddress; public string EmergencyContactPhone; } }


System.Attribute
System.Web.Profile.ProfileProviderAttribute


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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


カスタム プロファイルの実装で使用するプロパティのプロファイル プロバイダを識別するには、ProfileProviderAttribute クラスが使用されます。カスタム プロファイルの実装は ProfileBase 抽象クラスから継承したクラスであり、profile 構成要素で指定されていないユーザー プロファイルのプロパティを定義します。

ProfileBase クラスから継承するクラスを定義して、カスタム プロファイルを作成するコード例を次に示します。カスタム プロファイルの型は、アプリケーションの Web.config ファイルにある profile 構成要素の inherits 属性を使用して指定します。カスタム プロファイル実装を指定する構成ファイルの例は、ProfileProviderAttribute クラスの概要を参照してください。
Imports System Imports System.Web.Profile Namespace Samples.AspNet.Profile Public Class EmployeeProfile Inherits ProfileBase <SettingsAllowAnonymous(False)> _ <ProfileProvider("EmployeeInfoProvider")> _ Public Property Department As String Get Return MyBase.Item("EmployeeDepartment").ToString() End Get Set MyBase.Item("EmployeeDepartment") = value End Set End Property <SettingsAllowAnonymous(False)> _ <ProfileProvider("EmployeeInfoProvider")> _ Public Property Details As EmployeeInfo Get Return CType(MyBase.Item("EmployeeInfo"), EmployeeInfo) End Get Set MyBase.Item("EmployeeInfo") = value End Set End Property End Class Public Class EmployeeInfo Public Name As String Public Address As String Public Phone As String Public EmergencyContactName As String Public EmergencyContactAddress As String Public EmergencyContactPhone As String End Class End Namespace
using System; using System.Web.Profile; namespace Samples.AspNet.Profile { public class EmployeeProfile : ProfileBase { [SettingsAllowAnonymous(false)] [ProfileProvider("EmployeeInfoProvider")] public string Department { get { return base["EmployeeDepartment"].ToString(); } set { base["EmployeeDepartment"] = value; } } [SettingsAllowAnonymous(false)] [ProfileProvider("EmployeeInfoProvider")] public EmployeeInfo Details { get { return (EmployeeInfo)base["EmployeeInfo"]; } set { base["EmployeeInfo"] = value; } } } public class EmployeeInfo { public string Name; public string Address; public string Phone; public string EmergencyContactName; public string EmergencyContactAddress; public string EmergencyContactPhone; } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProfileProviderAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | ProviderName | ユーザー プロファイル プロパティのプロファイル プロバイダの名前を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

ProfileProviderAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

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

ProfileProviderAttribute メンバ
ユーザープロファイル プロパティのプロファイル プロバイダを識別します。
ProfileProviderAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | ProviderName | ユーザー プロファイル プロパティのプロファイル プロバイダの名前を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

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

- ProfileProviderAttributeのページへのリンク