是否可以使用System.ComponentModel.DataAnnotations为WebAPI响应对象命名类/ ViewModel,或者是否有替代方法;
//[DataMember(Name="CarDepot")] -- this doesn't work
//[Display(Name = "CarDepot")] -- this doesn't work
public partial class CarDepotVM
{
[Display(Name = "CarDepotVM")]
[DataMember(Order = 0)]
[Required]
public Car[] Cars { get; set; }
}
包含以下代码的库是PCL投诉,因此我不能使用任何不兼容的外部库。