/// <summary> /// Constructor. /// </summary> /// <param name="messageId">Message Id.</param> /// <param name="violationType">Type of the violation.</param> /// <param name="description">Description of the violation.</param> /// <param name="source"></param> /// <param name="line"></param> /// <param name="column"></param> public SerializationMessage(string messageId, ModelValidationViolationType violationType, string description, string source, int line, int column) : base(messageId, violationType, description) { this.source = source; this.line = line; this.column = column; }
/// <summary> /// Constructor. /// </summary> /// <param name="messageId">Message Id.</param> /// <param name="violationType">Type of the violation.</param> /// <param name="description">Description of the violation.</param> public ValidationMessage(string messageId, ModelValidationViolationType violationType, string description) { this.messageId = messageId; if (System.String.IsNullOrEmpty(this.messageId) || System.String.IsNullOrWhiteSpace(this.messageId)) this.messageId = ModelValidationMessageIds.UnknownMessageId; this.violationType = violationType; this.description = description; }
/// <summary> /// Constructor. /// </summary> /// <param name="messageId">Message Id.</param> /// <param name="violationType">Type of the violation.</param> /// <param name="description">Description of the violation.</param> public ValidationMessage(string messageId, ModelValidationViolationType violationType, string description) { this.messageId = messageId; if (System.String.IsNullOrEmpty(this.messageId) || System.String.IsNullOrWhiteSpace(this.messageId)) { this.messageId = "UnknownMessageId"; } this.violationType = violationType; this.description = description; }
/// <summary> /// Collects active messages of a given type. /// </summary> /// <param name="searchTypes">Types of messages to collect.</param> /// <returns>Set of collected messages.</returns> private ReadOnlyCollection <IValidationMessage> CollectMessages(ModelValidationViolationType searchTypes) { List <IValidationMessage> list = new List <IValidationMessage>(); foreach (IValidationMessage validationMessage in currentValidationMessages) { if ((validationMessage.Type & searchTypes) != 0) { list.Add(validationMessage); } } return(list.AsReadOnly()); }
/// <summary> /// Converts a model violation type to an error list item category. /// </summary> /// <param name="kind">Violation type to convert.</param> /// <returns>Error list item category that is corresponding to the violation type.</returns> public static ErrorListItemCategory ConvertCategory(ModelValidationViolationType kind) { if (kind == ModelValidationViolationType.Error) { return(ErrorListItemCategory.Error); } else if (kind == ModelValidationViolationType.Fatal) { return(ErrorListItemCategory.Fatal); } else if (kind == ModelValidationViolationType.Message) { return(ErrorListItemCategory.Message); } else { return(ErrorListItemCategory.Warning); } }
/// <summary> /// Converts a model violation type to an error list item category. /// </summary> /// <param name="kind">Violation type to convert.</param> /// <returns>Error list item category that is corresponding to the violation type.</returns> public static ErrorListItemCategory ConvertCategory(ModelValidationViolationType kind) { if (kind == ModelValidationViolationType.Error) return ErrorListItemCategory.Error; else if (kind == ModelValidationViolationType.Fatal) return ErrorListItemCategory.Fatal; else if (kind == ModelValidationViolationType.Message) return ErrorListItemCategory.Message; else return ErrorListItemCategory.Warning; }
/// <summary> /// Constructor. /// </summary> /// <param name="messageId">MessageId of this validation message.</param> /// <param name="violationType">Type of the violation.</param> /// <param name="description">Description of the violation.</param> /// <param name="source">Source element of the violation.</param> public ModelValidationMessage(string messageId, ModelValidationViolationType violationType, string description, ModelElement source) : base(messageId, violationType, description) { this.source = source; }