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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > 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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「ProfileProviderAttribute クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS