public static object GetRouteValues(MethodBase method, object key, MethodMapping methodMapping, TypeMapping typeMapping) { object routeValues = new { modelType = typeMapping.ModelType.PartialName(), index = methodMapping.Index }; if (!method.IsConstructor) { routeValues = new { modelType = typeMapping.ModelType.PartialName(), index = methodMapping.Index, methodName = methodMapping.MethodName }; } if (!method.IsStatic && key != null) { routeValues = new { modelType = typeMapping.ModelType.PartialName(), index = methodMapping.Index, methodName = methodMapping.MethodName, key }; } return routeValues; }
public MethodDescriptor(MethodMapping mapping, ActionDescriptor actionDescriptor) : base(mapping.Name) { Method = mapping.Method; Index = mapping.Index; Mapping = mapping; AttributeArray = Method.GetCustomAttributes(true).OfType<Attribute>().ToArray(); parameters.AddRange(Method.GetParameters().Select(info => new ReflectedParameterDescriptor(info, actionDescriptor))); }
private static void WriteMethod(StreamWriter writer, MethodMapping method, bool isStatic = false) { var removeId = isStatic ? ", id : null" : string.Empty; writer.Write("'{0}': {{ method:'POST', params : {{ methodName:'{1}' {2} ", ToCamelCase(method.MethodName), method.MethodName, removeId); //foreach (var parameter in method.Parameters) //{ // writer.Write(", {0}:'@{0}' ", parameter.Name); //} writer.WriteLine(" } }, "); }