示例#1
0
 /// <summary>
 /// Extract all <see cref="RuleArgument"/> items for a given Model, Property, and Rule Type.
 /// </summary>
 /// <param name="cfg">The Configuration data source to extract from.</param>
 /// <param name="modelName">The name of the Model to retrieve rules for.</param>
 /// <param name="propertyName">The name of the Property to retrieve rules for.</param>
 /// <param name="ruleType">The Type of Rule to retrieve arguments for.</param>
 /// <param name="ruleName">The name of the Rule to retrieve arguments for.</param>
 /// <param name="comparisonType">The string comparison method to be used. Defaults to <see cref="StringComparison.CurrentCultureIgnoreCase"/>.</param>
 /// <returns>The <see cref="RuleArgument"/> items corresponding to the provided Model, Property, Rule Type, and Name</returns>
 public static IEnumerable <RuleArgument> LookupArguments(this IRuleArgumentConfigProvider cfg, string modelName, string propertyName, RuleType ruleType, string ruleName, StringComparison comparisonType = StringComparison.CurrentCultureIgnoreCase)
 => cfg.LookupArguments(modelName, propertyName, ruleType, comparisonType).Where(p => string.Equals(p.Name, ruleName));
示例#2
0
 /// <summary>
 /// Extract all <see cref="RuleArgument"/> items from an <see cref="IRuleArgumentConfigProvider"/>.
 /// </summary>
 /// <param name="cfg">The Configuration data source to extract from.</param>
 /// <returns>All <see cref="RuleArgument"/> items for all Models.</returns>
 public static IEnumerable <RuleArgument> LookupArguments(this IRuleArgumentConfigProvider cfg)
 => cfg.Configuration.RuleDefinitions;