发送带有对象列表作为正文的POST请求时出现“歧义匹配”问题

时间:2018-09-07 01:11:34

标签: api inheritance post postman ambiguous

我在asp.net中有一个POST请求调用,其中包含以Body形式传递的对象列表(在名为richItems的参数中)。当我运行它时,出现此错误:

{
    "Message": "The request is invalid.",
    "ModelState": {
        "wealthItems": [
            "Ambiguous match found."
        ]
    }
}

我唯一能猜到的是我在此财富项的继承中创建为“新”的属性。请检查以下代码:

API调用:

public IHttpActionResult SyncWealthItemsForAccount([FromBody] List<IntegrationWealthItem> wealthItems, Data.Enumerations.IntegrationType integrationType, string accountGuidId)

这是我从“ wealthItems”基础类中获得的类。所有者将被“新”关键字覆盖。

public class IntegrationWealthItem : WealthItem
    {
        /// <summary>
        /// The wealth item's Id in the external third-party source.
        /// </summary>
        public string ExternalId { get; set; }

        /// <summary>
        /// The wealth item's owner list the external third-party source which contains ExternalID.
        /// </summary>
        public new List<IntegrationWealthItemOwner> Owners { get; set; }
    }

有什么主意吗?

0 个答案:

没有答案