/// <summary> /// Searches for a "CanExecute" method and add the Preview if found. /// </summary> /// <param name="manager">The manager.</param> /// <param name="method">The method.</param> protected void TryAddCanExecute(IFilterManager manager, IMethod method) { var found = method.GetMatchingMetadata <PreviewAttribute>() .Where(x => x.MethodName == "Can" + method.Info.Name ); if (found.Count() > 0) { return; } var canExecute = method.Info.DeclaringType.GetMethod( "Can" + method.Info.Name, method.Info.GetParameters().Select(x => x.ParameterType).ToArray() ) ?? method.Info.DeclaringType.GetMethod("get_Can" + method.Info.Name); if (canExecute != null) { manager.Add(new PreviewAttribute(_methodFactory.CreateFrom(canExecute))); } }
/// <summary> /// Searches for a "CanExecute" method and add the Preview if found. /// </summary> /// <param name="manager">The manager.</param> /// <param name="method">The method.</param> protected void TryAddCanExecute(IFilterManager manager, IMethod method) { var found = method.GetMatchingMetadata<PreviewAttribute>() .Where(x => x.MethodName == "Can" + method.Info.Name ); if(found.Count() > 0) return; var canExecute = method.Info.DeclaringType.GetMethod( "Can" + method.Info.Name, method.Info.GetParameters().Select(x => x.ParameterType).ToArray() ) ?? method.Info.DeclaringType.GetMethod("get_Can" + method.Info.Name); if(canExecute != null) manager.Add(new PreviewAttribute(_methodFactory.CreateFrom(canExecute))); }