ערוך

שתף באמצעות


ProfileAutoSaveEventArgs Class

Definition

Provides data for the ProfileAutoSaving event of the ProfileModule class.

public ref class ProfileAutoSaveEventArgs sealed : EventArgs
public sealed class ProfileAutoSaveEventArgs : EventArgs
type ProfileAutoSaveEventArgs = class
    inherit EventArgs
Public NotInheritable Class ProfileAutoSaveEventArgs
Inherits EventArgs
Inheritance
ProfileAutoSaveEventArgs

Examples

The following code example shows the ProfileAutoSaving event included in the Global.asax file for an ASP.NET application.

public void Profile_ProfileAutoSaving(object sender, ProfileAutoSaveEventArgs args)
{
  if (Profile.Cart.HasChanged)
    args.ContinueWithProfileAutoSave = true;
  else
    args.ContinueWithProfileAutoSave = false;
}
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

Remarks

The ProfileAutoSaveEventHandler delegate is defined for the ProfileAutoSaving event of the ProfileModule class. You can access the ProfileAutoSaving event of the ProfileModule class in the Global.asax file for your ASP.NET application, as shown in the example for this topic. The ProfileAutoSaving event is raised at the end of page execution if the ProfileManager.AutomaticSaveEnabled property is true.

The Save method automatically determines whether properties that are made up of primitive types, strings, or DateTime objects have been changed, by checking the IsDirty property value for each SettingsPropertyValue in the user profile. The Save method cannot explicitly determine whether a custom class has changed. You can use the ProfileAutoSaving event to determine whether a custom object has been modified and then either continue with the automatic save if the object has been modified or cancel the automatic save if the object has not been modified.

To cancel the automatic profile save operation, set the ContinueWithProfileAutoSave property to false in the ProfileAutoSaving event; otherwise, set the ContinueWithProfileAutoSave property to true.

There may be multiple subscribers to the ProfileAutoSaving event. The ProfileModule will use the last value that the ContinueWithProfileAutoSave property is set to. As a result, it is recommended that you explicitly set the ContinueWithProfileAutoSave property in the ProfileAutoSaving event regardless of whether you are canceling or continuing with the automatic save, as you may need to overwrite the value set by an earlier subscriber.

Constructors

ProfileAutoSaveEventArgs(HttpContext)

Creates an instance of the ProfileAutoSaveEventArgs class.

Properties

Context

Gets the HttpContext for the current request.

ContinueWithProfileAutoSave

Gets or sets a value indicating whether the ProfileModule will automatically save the user profile.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also