/// <summary>
        /// Registers a validation error with the local message collection as a critical error. The validation
        /// message will automatically be appended with the appropriate message extensions to reference the error being validated.
        /// </summary>
        /// <param name="context">The validation context in scope.</param>
        /// <param name="message">The error message.</param>
        protected void ValidationError(DocumentConstructionContext context, string message)
        {
            var graphMessage = GraphExecutionMessage.FromValidationRule(
                this,
                message,
                context.ActiveNode.Location.AsOrigin());

            context.Messages.Add(graphMessage);
        }
Example #2
0
        /// <summary>
        /// Registers a validation error with the local message collection as a critical error. The validation
        /// message will automatically be appended with the appropriate message extensions to reference the error being validated.
        /// </summary>
        /// <param name="context">The validation context in scope.</param>
        /// <param name="message">The error message to apply.</param>
        /// <param name="exception">The exception to add to the message, if any.</param>
        protected void ValidationError(
            FieldValidationContext context,
            string message,
            Exception exception = null)
        {
            var graphMessage = GraphExecutionMessage.FromValidationRule(
                this,
                message,
                context.DataItem.FieldContext.Origin,
                exception);

            context.Messages.Add(graphMessage);
        }