【发布时间】:2021-07-01 07:35:27
【问题描述】:
[ResponseType(typeof(PlanningRestGet))]
public HttpResponseMessage Put(int id, [FromBody] PlanningRestPut model)
{
return CallAndPrepareResponse(c => c.UpdatePlanning(id, model));
}
我创建了一个具有两个新属性的新“BaseRestPut”类,并让 PlanningRestPut 类继承了它。
但是现在当动作被执行时,来自基类的属性在模型对象中为空。
我已阅读此https://www.tutorialdocs.com/article/webapi-data-binding.html,但在我的情况下,我不想将基类作为参数传递,而是将派生类传递(并保留基类的属性。)
我怎样才能做到这一点?
【问题讨论】:
标签: .net asp.net-mvc asp.net-mvc-4