コード例 #1
0
        public IEnumerable <IInvalidationReason> Reasons(InvalidationSeverity severity)
        {
            IList <IInvalidationReason> reasons;

            if (!reasonsBySeverity.TryGetValue(severity, out reasons))
            {
                return(new IInvalidationReason[0]);
            }
            return(reasons);
        }
コード例 #2
0
        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;
        }
コード例 #3
0
 private MessageInvalidationReason(InvalidationSeverity severity, string messageKey, object[] parameters)
 {
     this.Severity          = severity;
     this.MessageKey        = messageKey;
     this.MessageParameters = parameters;
 }