/// <summary> /// Validates some member using the <paramref name="scopeProvider"/>. /// </summary> /// <typeparam name="T">type of the item to validate</typeparam> /// <param name="scopeProvider">The scope provider.</param> /// <param name="item">The item to validate.</param> /// <param name="name">The name of the variable that holds item to validate.</param> /// <param name="rules">The rules to run.</param> public static void Validate <T>(this INamedProvider <IScope> scopeProvider, T item, string name, params Rule <T>[] rules) { if (scopeProvider == null) { throw new ArgumentNullException("scopeProvider"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Provided string can't be null or empty", "name"); } // item can be null, it will be checked by the validation using (var scope = scopeProvider.Get(name)) { scope.CheckObject(item, rules); } }
public void Exception() { _provider.Get("0"); }
public static ILog CreateLog <T>(this INamedProvider <ILog> logProvider) where T : class { return(logProvider.Get(typeof(T).Name)); }