我在 Asp.Net MVC 4 上使用 Restsharp 序列化复杂对象时遇到问题。当我发送它时,对象没有到达完整的对象,它只与字符串或 int 或 long 一起到达,列表甚至 IList 不会' t 到达对象
这是我的对象:
public class Project
{
public long Id { get; set; }
public string NumPol { get; set; }
public string Name { get; set; }
public string Status { get; set; }
public System.DateTime CreationDate { get; set; }
public System.DateTime RenewalDate { get; set; }
public System.DateTime ExpirationDate { get; set; }
public long Notification { get; set; }
public decimal TotalSum { get; set; }
public int NoRenewal { get; set; }
public int Cancellation { get; set; }
public IList<Coin> Coinss { get; set; }
}
public class Moneda
{
public int Id { get; set; }
public string Name { get; set; }
}
和 Restsharp:
RestClient client = new RestClient("http://localhost:9212/");
RestRequest request = new RestRequest("Pol/CreatePol", Method.PUT);
request.RequestFormat = DataFormat.Json;
request.AddObject(project);
IRestResponse<ProjectoPol> response = client.Execute<ProjectoPol>(request);
对于如何解决这个问题,有任何的建议吗??