ReadAsAsync中的数据不正确

时间:2018-04-14 22:00:38

标签: c# backend

我正在调试我的应用程序的后端,并注意到一段数据在发送之间与收到数据之间的差异。

当我发送数据时,我使用某种模型。假设:

public string Age { get; set; }
public string Name { get; set; }
public string Occupation { get; set; }
public string Sex { get; set; }

当我最初发送模型时,其所有字段都已正确设置。当我收到该对象时,它会丢失NameOccupation

模型在每一端都是相同的,唯一不同的是名称。

以下是我发送和接收数据的方式:

using (var response = await RawGetAsync(cancellationToken, $"my/custom/endpoint/{customer}").ConfigureAwait(false))
{
    if (!response.IsSuccessStatusCode)
    {
        throw new HttpResponseException(response.StatusCode);
    }

    return await response.Content.ReadAsAsync<MyModel>(cancellationToken).ConfigureAwait(false);
}

0 个答案:

没有答案