猿问

Visual Studio 和 Swagger/Swashbuckle - 部署具有

DateTimeOffset当我部署具有参数的WebAPI 时,当我REST API client...在 Visual Studio 项目中使用 Add 时,它只会将其视为 DateTime 类型。


** WebAPI:


public IHttpActionResult GetCustomer(DateTimeOffset myDate) { ... }


** Swagger: 

SwaggerUI show type as a datetime..



** Client Project:

Add REST API Client...

下来为 DateTime 而不是 DateTimeOffset。


有任何想法吗?


噜噜哒
浏览 88回答 1
1回答

桃花长相依

这是对我有用的一个片段网址:&nbsp; &nbsp; public async Task<IHttpActionResult> CreateFollowUp(string uniqueid, DateTimeOffset? workStart, ....){....}移动的:&nbsp; public async Task CreateFollowUP(string uniqueid, DateTimeOffset? workStart, ...)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; try&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; await RetryPolicy().ExecuteAsync(async () =>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using (client)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var fullurl = RestUrl + $"followups/CreateFollowUp?uniqueid={uniqueid}&workStart={workStart.Value.ToString("MM/dd/yyyy HH:mm:ss tt")}...";
随时随地看视频慕课网APP
我要回答