public static string GenerateUrlWithParameters(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo actionInfo) { var baseUrl = "api/services/" + controllerInfo.ServiceName + "/" + actionInfo.ActionName; var primitiveParameters = actionInfo.Method .GetParameters() .Where(p => TypeHelper.IsPrimitiveIncludingNullable(p.ParameterType)) .ToArray(); if (!primitiveParameters.Any()) { return baseUrl; } var urlBuilder = new StringBuilder(baseUrl); if (!baseUrl.Contains("?")) { urlBuilder.Append("?"); } for (var i = 0; i < primitiveParameters.Length; i++) { var parameterInfo = primitiveParameters[i]; if (i > 0) { urlBuilder.Append("&"); } urlBuilder.Append(parameterInfo.Name.ToCamelCase() + "=' + escape(" + parameterInfo.Name.ToCamelCase() + ") + '"); } return urlBuilder.ToString(); }
public static ActionScriptProxyGenerator CreateActionScriptProxyGenerator(this HttpVerb verb, DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { switch (verb) { case HttpVerb.Get: return new HttpGetActionScriptProxyGenerator(controllerInfo, methodInfo); case HttpVerb.Post: return new HttpPostActionScriptProxyGenerator(controllerInfo, methodInfo); case HttpVerb.Put: return new HttpPutActionScriptProxyGenerator(controllerInfo, methodInfo); case HttpVerb.Delete: return new HttpDeleteActionScriptProxyGenerator(controllerInfo, methodInfo); default: throw new AbpException("This Http verb is not implemented: " + verb); } }
private static ActionScriptWriter CreateActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { switch (methodInfo.Verb) { case HttpVerb.Get: return new GetActionScriptWriter(controllerInfo, methodInfo); case HttpVerb.Post: return new PostActionScriptWriter(controllerInfo, methodInfo); case HttpVerb.Put: return new PostActionScriptWriter(controllerInfo, methodInfo); case HttpVerb.Delete: return new DeleteActionScriptWriter(controllerInfo, methodInfo); default: throw new AbpException("This Http verb is not implemented: " + methodInfo.Verb); } }
public static string GenerateBody(DynamicApiActionInfo actionInfo) { var parameters = actionInfo.Method .GetParameters() .Where(p => !TypeHelper.IsPrimitiveIncludingNullable(p.ParameterType)) .ToArray(); if (parameters.Length <= 0) { return "{}"; } if (parameters.Length > 1) { throw new AbpException("Only one complex type allowed as argument to a web api controller action. But " + actionInfo.ActionName + " contains more than one!"); } return parameters[0].Name.ToCamelCase(); }
public DynamicHttpActionDescriptor( IAbpWebApiConfiguration configuration, HttpControllerDescriptor controllerDescriptor, DynamicApiActionInfo actionInfo) : base( controllerDescriptor, actionInfo.Method) { _actionInfo = actionInfo; SupportedHttpMethods = new Collection<HttpMethod> { actionInfo.Verb.ToHttpMethod() }; Properties["__AbpDynamicApiActionInfo"] = actionInfo; Properties["__AbpDynamicApiDontWrapResultAttribute"] = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault( actionInfo.Method, configuration.DefaultDynamicApiWrapResultAttribute ); _filters = new Lazy<Collection<IFilter>>(GetFiltersInternal, true); _parameters = new Lazy<Collection<HttpParameterDescriptor>>(GetParametersInternal, true); }
public DynamicHttpActionDescriptor( IAbpWebApiConfiguration configuration, HttpControllerDescriptor controllerDescriptor, DynamicApiActionInfo actionInfo) : base( controllerDescriptor, actionInfo.Method) { _actionInfo = actionInfo; SupportedHttpMethods = new Collection <HttpMethod> { actionInfo.Verb.ToHttpMethod() }; Properties["__AbpDynamicApiActionInfo"] = actionInfo; Properties["__AbpDynamicApiDontWrapResultAttribute"] = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault( actionInfo.Method, configuration.DefaultDynamicApiWrapResultAttribute ); _filters = new Lazy <Collection <IFilter> >(GetFiltersInternal, true); _parameters = new Lazy <Collection <HttpParameterDescriptor> >(GetParametersInternal, true); }
public JQueryActionScriptGenerator(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo actionInfo) { _controllerInfo = controllerInfo; _actionInfo = actionInfo; }
public AngularActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { _controllerInfo = controllerInfo; _actionInfo = methodInfo; }
public static string GenerateUrlWithParameters(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo actionInfo) { var baseUrl = "api/services/" + controllerInfo.ServiceName + "/" + actionInfo.ActionName; var primitiveParameters = actionInfo.Method .GetParameters() .Where(p => TypeHelper.IsPrimitiveExtendedIncludingNullable(p.ParameterType)) .ToArray(); if (!primitiveParameters.Any()) { return(baseUrl); } var urlBuilder = new StringBuilder(baseUrl); if (!baseUrl.Contains("?")) { urlBuilder.Append("?"); } for (var i = 0; i < primitiveParameters.Length; i++) { var parameterInfo = primitiveParameters[i]; if (i > 0) { urlBuilder.Append("&"); } urlBuilder.Append(parameterInfo.Name.ToCamelCase() + "=' + encodeURIComponent(" + parameterInfo.Name.ToCamelCase() + ") + '"); } return(urlBuilder.ToString()); }
public HttpPostActionScriptProxyGenerator(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) : base(controllerInfo, methodInfo) { }
public JQueryActionScriptGenerator(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo actionInfo) { _controllerInfo = controllerInfo; _actionInfo = actionInfo; }
private static void AppendMethod(StringBuilder script, DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { var generator = methodInfo.Verb.CreateActionScriptProxyGenerator(controllerInfo, methodInfo); script.AppendLine(generator.GenerateMethod()); }
protected ActionScriptProxyGenerator(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { ControllerInfo = controllerInfo; ActionInfo = methodInfo; }
public static string GenerateUrlWithParameters(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo actionInfo) { var baseUrl = "api/services/" + controllerInfo.ServiceName + "/" + actionInfo.ActionName; var primitiveParameters = actionInfo.Method .GetParameters() .Where(p => TypeHelper.IsPrimitiveExtendedIncludingNullable(p.ParameterType)) .ToArray(); if (!primitiveParameters.Any()) { return(baseUrl); } var qsBuilderParams = primitiveParameters .Select(p => $"{{ name: '{p.Name.ToCamelCase()}', value: " + p.Name.ToCamelCase() + " }") .JoinAsString(", "); return(baseUrl + $"' + abp.utils.buildQueryString([{qsBuilderParams}]) + '"); }
protected ActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { ControllerInfo = controllerInfo; MethodInfo = methodInfo; }
public PostActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) : base(controllerInfo, methodInfo) { }
private static void AppendMethod(StringBuilder script, DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { var generator = new JQueryActionScriptGenerator(controllerInfo, methodInfo); script.AppendLine(generator.GenerateMethod()); }
private static void AppendMethod(StringBuilder script, DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { var generator = new JQueryActionScriptGenerator(controllerInfo, methodInfo); script.AppendLine(generator.GenerateMethod()); }
public static ActionScriptProxyGenerator CreateActionScriptProxyGenerator(this HttpVerb verb, DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { switch (verb) { case HttpVerb.Get: return(new HttpGetActionScriptProxyGenerator(controllerInfo, methodInfo)); case HttpVerb.Post: return(new HttpPostActionScriptProxyGenerator(controllerInfo, methodInfo)); case HttpVerb.Put: return(new HttpPutActionScriptProxyGenerator(controllerInfo, methodInfo)); case HttpVerb.Delete: return(new HttpDeleteActionScriptProxyGenerator(controllerInfo, methodInfo)); default: throw new AbpException("This Http verb is not implemented: " + verb); } }
private static ActionScriptWriter CreateActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { switch (methodInfo.Verb) { case HttpVerb.Get: return(new GetActionScriptWriter(controllerInfo, methodInfo)); case HttpVerb.Post: return(new PostActionScriptWriter(controllerInfo, methodInfo)); case HttpVerb.Put: return(new PostActionScriptWriter(controllerInfo, methodInfo)); case HttpVerb.Delete: return(new DeleteActionScriptWriter(controllerInfo, methodInfo)); default: throw new AbpException("This Http verb is not implemented: " + methodInfo.Verb); } }
public AngularActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { _controllerInfo = controllerInfo; _actionInfo = methodInfo; }
public PostActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) : base(controllerInfo, methodInfo) { }
private static void AppendMethod(StringBuilder script, DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { var generator = methodInfo.Verb.CreateActionScriptProxyGenerator(controllerInfo, methodInfo); script.AppendLine(generator.GenerateMethod()); }
protected ActionScriptProxyGenerator(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { ControllerInfo = controllerInfo; ActionInfo = methodInfo; }
public HttpGetActionScriptProxyGenerator(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) : base(controllerInfo, methodInfo) { }
protected ActionScriptWriter(DynamicApiControllerInfo controllerInfo, DynamicApiActionInfo methodInfo) { ControllerInfo = controllerInfo; MethodInfo = methodInfo; }