/// <summary> /// Initializes an instance of the object. /// </summary> public ConsensusRuleDescriptor(ConsensusRule rule) { this.Rule = rule; this.Attributes = Attribute.GetCustomAttributes(rule.GetType()).OfType <RuleAttribute>().ToList(); this.validationRuleAttribute = this.Attributes.OfType <ValidationRuleAttribute>().FirstOrDefault(); }
/// <summary> /// Initializes an instance of the object. /// </summary> public ConsensusRuleDescriptor(ConsensusRule rule) { Guard.NotNull(rule, nameof(rule)); this.Rule = rule; this.RuleAttributes = Attribute.GetCustomAttributes(rule.GetType()).OfType <RuleAttribute>().ToList(); var validationRuleAttribute = this.RuleAttributes.OfType <ValidationRuleAttribute>().FirstOrDefault(); this.CanSkipValidation = validationRuleAttribute?.CanSkipValidation ?? !this.RuleAttributes.Any(); }