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

ProfileAutoSaveEventArgs クラス

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

ProfileModule クラスの ProfileAutoSaving イベントのデータを提供します。

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

Public NotInheritable Class
 ProfileAutoSaveEventArgs
    Inherits EventArgs
Dim instance As ProfileAutoSaveEventArgs
public sealed class ProfileAutoSaveEventArgs
 : EventArgs
public ref class ProfileAutoSaveEventArgs sealed
 : public EventArgs
public final class ProfileAutoSaveEventArgs
 extends EventArgs
public final class ProfileAutoSaveEventArgs
 extends EventArgs
解説解説

ProfileAutoSaveEventHandler デリゲートは、ProfileModule クラスの ProfileAutoSaving イベントに対して定義されています。ASP.NET アプリケーションの Global.asax ファイルの ProfileModule クラスの ProfileAutoSaving イベントには、このトピックの例に示されている方法によってアクセスできます。ProfileAutoSaving イベントは、ProfileManager.AutomaticSaveEnabled プロパティが true の場合、ページ実行の終了時に発生します。

Save メソッドは、プリミティブ型、文字列、または DateTime オブジェクトで構成されたプロパティ値が変更されたかどうかを、ユーザー プロファイル内の各 SettingsPropertyValue の IsDirty プロパティ値をチェックすることで、自動的に判断します。Save メソッドは、カスタム クラスが変更されたかどうかを明示的に判断することはできません。カスタム オブジェクトが変更されたかどうかは、ProfileAutoSaving イベントを使用して判断できます。その上で、オブジェクトが変更されている場合は自動保存を続行し、変更されていない場合は自動保存をキャンセルできます。

プロファイルの自動保存処理をキャンセルする場合は、ProfileAutoSaving イベント内の ContinueWithProfileAutoSave プロパティを false に設定します。それ以外の場合は、ContinueWithProfileAutoSave プロパティを true に設定します。

ProfileAutoSaving イベントに対しては複数のサブスクライバが存在する場合があります。ProfileModule は、ContinueWithProfileAutoSave プロパティに最後に設定された値を使用します。したがって、ProfileAutoSaving イベント内では、自動保存をキャンセルするか続行するかにかかわらず ContinueWithProfileAutoSave プロパティを明示的に設定して、以前のサブスクライバの設定した値が上書きされるようにすることをお勧めします。

使用例使用例

ASP.NET アプリケーションの Global.asax ファイルに含まれる ProfileAutoSaving イベントを次のコード例に示します。

Public Sub Profile_ProfileAutoSaving(sender
 As Object, args As ProfileAutoSaveEventArgs)
  If Profile.Cart.HasChanged Then
    args.ContinueWithProfileAutoSave = True
  Else
    args.ContinueWithProfileAutoSave = False
  End If
End Sub
public void Profile_ProfileAutoSaving(object
 sender, ProfileAutoSaveEventArgs args)
{
  if (Profile.Cart.HasChanged)
    args.ContinueWithProfileAutoSave = true;
  else
    args.ContinueWithProfileAutoSave = false;
}
継承階層継承階層
System.Object
   System.EventArgs
    System.Web.Profile.ProfileAutoSaveEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ProfileAutoSaveEventArgs コンストラクタ

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

ProfileAutoSaveEventArgs クラスのインスタンスを作成します。

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

Public Sub New ( _
    context As HttpContext _
)
Dim context As HttpContext

Dim instance As New ProfileAutoSaveEventArgs(context)
public ProfileAutoSaveEventArgs (
    HttpContext context
)
public:
ProfileAutoSaveEventArgs (
    HttpContext^ context
)
public ProfileAutoSaveEventArgs (
    HttpContext context
)
public function ProfileAutoSaveEventArgs (
    context : HttpContext
)

パラメータ

context

現在の要求の HttpContext。

解説解説

ProfileAutoSaveEventArgs は、ProfileAutoSaveEventArgs クラスのインスタンスを作成し、Context プロパティを指定された HttpContext に設定します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ProfileAutoSaveEventArgs プロパティ


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

  名前 説明
パブリック プロパティ Context 現在の要求に対する HttpContext を取得します。
パブリック プロパティ ContinueWithProfileAutoSave ProfileModule がユーザー プロファイルを自動保存するかどうかを示す値を取得または設定します。
参照参照

関連項目

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

その他の技術情報

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

ProfileAutoSaveEventArgs メソッド


ProfileAutoSaveEventArgs メンバ

ProfileModule クラスの ProfileAutoSaving イベントのデータを提供します。

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ProfileAutoSaveEventArgs ProfileAutoSaveEventArgs クラスのインスタンスを作成します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Context 現在の要求に対する HttpContext を取得します。
パブリック プロパティ ContinueWithProfileAutoSave ProfileModule がユーザー プロファイルを自動保存するかどうかを示す値を取得または設定します。
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

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

その他の技術情報

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



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「ProfileAutoSaveEventArgs」の関連用語

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

   

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



ProfileAutoSaveEventArgsのページの著作権

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

©2026 GRAS Group, Inc.RSS