0
是否有任何方法来修改ModelState属性的键?我收到以下JSON响应:修改ModelState MVC属性的键/值对
{"Message":"The request is invalid.",
"ModelState":
{
"supplier.SupplierWarehouses[2].Location":["Location name is too long, maximum 50 characters"]
}
}
我想修改supplier.SupplierWarehouses [2] .Location的东西更简单的像SupplierLocation。
有什么办法可以直接在模型中做到这一点?我目前的型号是:
public class SupplierWarehouseMetadata
{
[StringLength(50,ErrorMessage="Location name is too long, maximum 50 characters")]
public string Location { get; set; }
}