/// <summary> /// Controller action interceptor that changes the action name when specified by attribute /// </summary> /// <param name="definition">Controller action definition</param> /// <returns> /// Value indicating whether to accept the controller action /// </returns> public bool Intercept(ControllerActionDefinition definition) { var attribute = definition.Method .GetCustomAttributes(actionNameAttribute, true) .OfType<ActionNameAttribute>() .FirstOrDefault(); if (attribute != null) definition.ActionName = attribute.Name; return true; }
public bool Intercept(ControllerActionDefinition definition) { return ReturnValue; }
/// <summary> /// Controller action interceptor /// </summary> /// <param name="definition">Controller action definition</param> /// <returns> /// Value indicating whether to accept the controller action /// </returns> public bool Intercept(ControllerActionDefinition definition) { var parameters = definition.Method .GetParameters() .Select(p => new ParameterResult { Name = p.Name, Optional = p.IsOptional || (p.ParameterType.IsGenericType && p.ParameterType.GetGenericTypeDefinition().Equals(nullableType)), DefaultValue = serializer.Serialize(p.DefaultValue ?? string.Empty), Description = this.findReader(definition.Method.DeclaringType.Assembly).ParameterDescription(definition.Method, p.Name), ParameterInfo = p }); foreach (var param in parameters) definition.Parameters.AddLast(param); return true; }
/// <summary> /// Controller action interceptor that removes method with non-action attribute /// </summary> /// <param name="definition">Controller action definition</param> /// <returns> /// Value indicating whether to accept the controller action /// </returns> public bool Intercept(ControllerActionDefinition definition) { return !definition.Method.GetCustomAttributes(nonActionAttribute, true).Any(); }
/// <summary> /// Controller action interceptor /// </summary> /// <param name="definition">Controller action definition</param> /// <returns> /// Value indicating whether to accept the controller action /// </returns> public bool Intercept(ControllerActionDefinition definition) { definition.Description = this.findReader(definition.Method.DeclaringType.Assembly).MethodDescription(definition.Method); return true; }