Dynamicweb 8 Documentation
NotificationContext Class
Members  Example 

Use this object inside a Using statement to handle how notifications are handled. Can be used to supres all notifications from objects and code run within this using block.
Syntax
'Declaration
 
Public Class NotificationContext 
public class NotificationContext 
Example
Updating data in the databaseUpdating data in the database
namespace Notifications
{
    public class NotificationContextSample
    {
        public void DoSave()
        {
            //Create an instance of the Notification Context in the state of supressing notifications. No notifications will be triggered until end using is called.
            using (new Dynamicweb.Extensibility.NotificationContext(Dynamicweb.Extensibility.NotificationContext.State.SupresNotifications))
            {
                //Have whatever code block that would normally trigger some notifications
                Dynamicweb.Modules.UserManagement.User user = Dynamicweb.Modules.UserManagement.User.GetCurrentUser();
                user.Name = "John Doe";
                user.Save(); //This call to User.Save() will normally trigger i.e. Notifications.UserOnBeforeSave and Notifications.UserSaved notifications
            }
            // end this state. After this notifications will be triggered as expected
        }
    }
}
Namespace Notifications
    Public Class NotificationContextSample
        Public Sub DoSave()
            'Create an instance of the Notification Context in the state of supressing notifications. No notifications will be triggered until end using is called.
            Using New Global.Dynamicweb.Extensibility.NotificationContext(Extensibility.NotificationContext.State.SupresNotifications)
                'Have whatever code block that would normally trigger some notifications
                Dim user As Global.Dynamicweb.Modules.UserManagement.User = Global.Dynamicweb.Modules.UserManagement.User.GetCurrentUser
                user.Name = "John Doe"
                user.Save() 'This call to User.Save() will normally trigger i.e. Notifications.UserOnBeforeSave and Notifications.UserSaved notifications
            End Using ' end this state. After this notifications will be triggered as expected
        End Sub
    End Class
End Namespace
Inheritance Hierarchy

System.Object
   Dynamicweb.Extensibility.NotificationContext

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

NotificationContext Members
Dynamicweb.Extensibility Namespace

Send Feedback