Dynamicweb.Extensibility Namespace : NotificationContext Class |
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
System.Object
Dynamicweb.Extensibility.NotificationContext
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