public ClientApiFunctionGen(WebApiDescription description, Poco2Client.Poco2CsGen poco2CsGen, CodeGenOutputs settings, bool forAsync) { this.description = description; //this.sharedContext = sharedContext; this.poco2CsGen = poco2CsGen; this.settings = settings; this.forAsync = forAsync; this.stringAsString = settings.StringAsString; //this.diFriendly = settings.DIFriendly; statementOfEnsureSuccessStatusCode = settings.UseEnsureSuccessStatusCodeEx ? "EnsureSuccessStatusCodeEx" : "EnsureSuccessStatusCode"; methodName = description.ActionDescriptor.ActionName; if (methodName.EndsWith("Async")) { methodName = methodName.Substring(0, methodName.Length - 5); } returnType = description.ResponseDescription?.ResponseType ?? description.ActionDescriptor.ReturnType; returnTypeIsStream = returnType != null && ((returnType.FullName == typeNameOfHttpResponseMessage) || (returnType.FullName == typeOfIHttpActionResult) || (returnType.FullName == typeOfIActionResult) || (returnType.FullName == typeOfActionResult) || (returnType.FullName.StartsWith("System.Threading.Tasks.Task`1[[Microsoft.AspNetCore.Mvc.IActionResult")) || // .net core is not translating Task<IActionResult> properly. (returnType.FullName.StartsWith("System.Threading.Tasks.Task`1[[Microsoft.AspNetCore.Mvc.IHttpActionResult")) || (returnType.FullName.StartsWith("System.Threading.Tasks.Task`1[[Microsoft.AspNetCore.Mvc.ActionResult")) ); returnTypeIsDynamicObject = returnType != null && returnType.FullName != null && returnType.FullName.StartsWith("System.Threading.Tasks.Task`1[[System.Object"); }
public static CodeMemberMethod Create(WebApiDescription description, Poco2Client.Poco2CsGen poco2CsGen, CodeGenOutputs settings, bool forAsync) { var gen = new ClientApiFunctionGen(description, poco2CsGen, settings, forAsync); return(gen.CreateApiFunction()); }