public ClientApiFunctionGen(SharedContext sharedContext, WebApiDescription description, Poco2Client.Poco2CsGen poco2CsGen, bool stringAsString, bool forAsync, bool diFriendly, bool useEnsureSuccessStatusCodeEx) { this.description = description; this.sharedContext = sharedContext; this.poco2CsGen = poco2CsGen; this.forAsync = forAsync; this.stringAsString = stringAsString; this.diFriendly = diFriendly; statementOfEnsureSuccessStatusCode = 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(SharedContext sharedContext, WebApiDescription description, Poco2Client.Poco2CsGen poco2CsGen, bool stringAsString, bool forAsync, bool diFriendly, bool useEnsureSuccessStatusCodeEx) { var gen = new ClientApiFunctionGen(sharedContext, description, poco2CsGen, stringAsString, forAsync, diFriendly, useEnsureSuccessStatusCodeEx); return(gen.CreateApiFunction()); }
public static CodeMemberMethod Create(WebApiDescription description, Poco2Client.Poco2CsGen poco2CsGen, CodeGenOutputs settings, bool forAsync) { var gen = new ClientApiFunctionGen(description, poco2CsGen, settings, forAsync); return(gen.CreateApiFunction()); }