public IEnumerable <IInvalidationReason> Reasons(InvalidationSeverity severity) { IList <IInvalidationReason> reasons; if (!reasonsBySeverity.TryGetValue(severity, out reasons)) { return(new IInvalidationReason[0]); } return(reasons); }
public PropertyInvalidationReason(string typeName, string propertyName, IInvalidationReason valueReason) { this.typeName = typeName; this.propertyName = propertyName; this.severity = valueReason.Severity; var propertyReason = valueReason as PropertyInvalidationReason; if (propertyReason != null) { this.originalInvalidMessageKey = propertyReason.originalInvalidMessageKey; this.messsageKey = string.Format("{0}.{1}.{2}.{3}", typeName, propertyName, propertyReason.propertyName, originalInvalidMessageKey); } else { this.originalInvalidMessageKey = valueReason.MessageKey; this.messsageKey = string.Format("{0}.{1}.{2}", typeName, propertyName, valueReason.MessageKey); } messageParameters = valueReason.MessageParameters; }
private MessageInvalidationReason(InvalidationSeverity severity, string messageKey, object[] parameters) { this.Severity = severity; this.MessageKey = messageKey; this.MessageParameters = parameters; }