ProfileProviderAttributeとは? わかりやすく解説

ProfileProviderAttribute クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

ユーザープロファイル プロパティプロファイル プロバイダ識別します。

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

<AttributeUsageAttribute(AttributeTargets.Property)> _
Public NotInheritable Class
 ProfileProviderAttribute
    Inherits Attribute
Dim instance As ProfileProviderAttribute
[AttributeUsageAttribute(AttributeTargets.Property)] 
public sealed class ProfileProviderAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Property)] 
public ref class ProfileProviderAttribute sealed
 : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property) */ 
public final class ProfileProviderAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Property) 
public final class ProfileProviderAttribute
 extends Attribute
解説解説

カスタム プロファイル実装使用するプロパティプロファイル プロバイダ識別するには、ProfileProviderAttribute クラス使用されます。カスタム プロファイル実装は ProfileBase 抽象クラスから継承したクラスであり、profile 構成要素指定されていないユーザー プロファイルプロパティ定義しますユーザー プロファイルカスタム型は、次の例に示すように、アプリケーションの Web.config ファイルにある profile 構成要素inherits 属性使用して指定できます

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

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

<add name="GarmentSize" />

</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;
  }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Attribute
    System.Web.Profile.ProfileProviderAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ProfileProviderAttribute コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したプロファイル プロバイダ名を使用して ProfileProviderAttribute クラス新しインスタンス作成します

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

Public Sub New ( _
    providerName As String _
)
Dim providerName As String

Dim instance As New ProfileProviderAttribute(providerName)
public ProfileProviderAttribute (
    string providerName
)
public:
ProfileProviderAttribute (
    String^ providerName
)
public ProfileProviderAttribute (
    String providerName
)
public function ProfileProviderAttribute (
    providerName : String
)

パラメータ

providerName

プロパティプロファイル プロバイダの名前。

解説解説
使用例使用例

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;
  }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ProfileProviderAttribute プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

ProfileProviderAttribute クラス
System.Web.Profile 名前空間

その他の技術情報

ASP.NET プロファイル プロパティ

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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ProfileProviderAttribute クラス
System.Web.Profile 名前空間

その他の技術情報

ASP.NET プロファイル プロパティ

ProfileProviderAttribute メンバ

ユーザープロファイル プロパティプロファイル プロバイダ識別します。

ProfileProviderAttribute データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ProfileProviderAttribute 指定したプロファイル プロバイダ名を使用して 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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ProfileProviderAttribute クラス
System.Web.Profile 名前空間

その他の技術情報

ASP.NET プロファイル プロパティ



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

辞書ショートカット

すべての辞書の索引

「ProfileProviderAttribute」の関連用語

ProfileProviderAttributeのお隣キーワード
検索ランキング

   

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



ProfileProviderAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS