Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataValidationResultItem"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="memberName">(Optional) the member name.</param>
        /// <param name="severity">(Optional) the severity.</param>
        public DataValidationResultItem(string message, string memberName = null, DataValidationSeverity severity = DataValidationSeverity.Error)
        {
            Contract.Requires(message != null);

            this.Message = message;
            this.MemberName = memberName;
            this.Severity = severity;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataValidationResult"/> class
        /// by adding a new item with the provided parameters.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="memberName">(Optional) name of the member.</param>
        /// <param name="severity">(Optional) the severity.</param>
        public DataValidationResult(string message, string memberName = null, DataValidationSeverity severity = DataValidationSeverity.Error)
        {
            Contract.Requires(message != null);

            this.Add(message, memberName, severity);
        }
Пример #3
0
        /// <summary>
        /// Adds a result item to the validation result.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="memberName">(Optional) name of the member.</param>
        /// <param name="severity">(Optional) the severity.</param>
        /// <returns>
        /// This <see cref="DataValidationResult"/>.
        /// </returns>
        public DataValidationResult Add(string message, string memberName = null, DataValidationSeverity severity = DataValidationSeverity.Error)
        {
            Contract.Requires(message != null);

            this.items.Add(new DataValidationResultItem(message, memberName, severity));
            return this;
        }