看XML數據我當我使用asp.net網站的API和eventhough我個人喜歡用HttpResponseMessage
和Request.CreateResponse
我可以讓客戶來決定他們寧可在上班,以處理我的JSON數據。如何使用Request.CreateResponse在xml中控制節點名稱?
然而看到節點名稱很可怕。我想知道除了更改文件名之外,它們是否可以更改?我嘗試過xmlRoot,但沒有做任何事情。
比如我不喜歡這樣
return Request.CreateResponse<ResponseResult<List<PersonSearchDto>>>(HttpStatusCode.OK, p);
回我得到一個名爲像這樣的根節點
ResponseResultOfArrayOfPersonSearchK0AojvId
將是很好,如果我可以重命名爲類似Persons
爲什麼downvote? – 2013-04-21 01:58:04
不知道爲什麼你被拒絕了......智能不會給我輸入的命名空間。這僅適用於wcf嗎?我正在使用asp.net web api。 – chobo2 2013-04-21 02:37:24
適用於Web API ...您需要添加對「System.Runtime.Serialization.dll」的引用。 – 2013-04-21 02:44:32