We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I create a method on an ApiController with a nullable DateTime as a parameter, e.g.:
[Route("nullabledate")] public void NullableDateTest(DateTime? nullableDate) { Console.Write(nullableDate); }
When generating the C# client with WebApiProxy-Generate-CSharp, I get the following code in WebApiProxy.generated.cs:
WebApiProxy-Generate-CSharp
/// <summary> /// /// </summary> /// <param name="nullableDate"></param> /// <returns></returns> protected virtual async Task<HttpResponseMessage> NullableDateTestAsyncMsg(Nullable<DateTime> nullableDate) { return await HttpClient.PostAsJsonAsync("profiles/nullabledate?nullableDate=" + nullableDate.ToString("o"), default(HttpResponseMessage)); } /// <summary> /// /// </summary> /// <param name="nullableDate"></param> /// <returns></returns> public virtual async Task<HttpResponseMessage> NullableDateTestAsync(Nullable<DateTime> nullableDate) { return await HttpClient.PostAsJsonAsync("profiles/nullabledate?nullableDate=" + nullableDate.ToString("o"), default(HttpResponseMessage)); }
The calls to nullableDate.ToString("o") produce the following error:
nullableDate.ToString("o")
No overload for method 'ToString' takes 1 arguments
Is there a way to get around this?
The text was updated successfully, but these errors were encountered:
I haven't tested it very thoroughly, but the following change works for me for now:
ngm@babd3d2
Basically - if it's a Nullable<DateTime>, then ToString("o") its .Value, otherwise return the empty string.
Nullable<DateTime>
ToString("o")
.Value
Sorry, something went wrong.
No branches or pull requests
If I create a method on an ApiController with a nullable DateTime as a parameter, e.g.:
When generating the C# client with
WebApiProxy-Generate-CSharp
, I get the following code in WebApiProxy.generated.cs:The calls to
nullableDate.ToString("o")
produce the following error:Is there a way to get around this?
The text was updated successfully, but these errors were encountered: