/// <summary> /// Initializes a new instance of the exception class with a specified error message and /// a reference to the inner exception that is the cause of this exception. /// </summary> /// <param name="message"> /// The error message that explains the reason for the exception. /// </param> /// <param name="innerException"> /// The exception that is the cause of the current exception, or a null reference /// (Nothing in Visual Basic) if no inner exception is specified. /// </param> protected BusinessOperationException( string message, Exception innerException) : base(message, innerException) { Notifications = new NotificationList(); }
/// <summary> /// Ensures that the list of notifications is initialized /// </summary> private void EnsureNotifications() { if (Notifications == null) { Notifications = new NotificationList(); } }
/// <summary> /// Initializes a new instance of the exception class. /// </summary> protected BusinessOperationException() { Notifications = new NotificationList(); }
/// <summary> /// This method sets the collection of the business operation notifications according to the /// specified parameter, and retrieves this exception object. /// </summary> /// <param name="notifications">Business operation notifications</param> /// <returns>This exception object</returns> /// <remarks> /// This method can be used directly in throw statement: /// throw MyBusinessOperationException().SetNotifications(myNotifications); /// </remarks> public BusinessOperationException SetNotifications(NotificationList notifications) { Notifications = notifications; return this; }
/// <summary> /// Resets this object by removing all validation notifications /// </summary> public void Reset() { _notifications = new NotificationList(); }