我有这门课
[DataContract]
public class InsertLoansResponse
{
private ProcSummary _processingSummary;
private List<InsertLoanResponse> _items;
[DataMember]
public List<InsertLoanResponse> InsertLoanResponses
{
get { return _items ?? (_items = new List<InsertLoanResponse>()); }
set { _items = value; }
}
[DataMember]
public ProcSummary ProcessingSummary
{
get { return _processingSummary ?? (_processingSummary = new ProcSummary()); }
set { _processingSummary = value; }
}
public void Add(InsertLoanResponse localState)
{
InsertLoanResponses.Add(localState);
}
[DataContract]
public class ProcSummary
{
[DataMember(Name = "Success")]
public int SuccessCount { get; set; }
[DataMember(Name = "Failure")]
public int FailureCount { get; set; }
}
}
这是我的服务中方法的响应类型。
我最终得到如下所示的 xml:
<InsertLoansResponse>
<InsertLoanResponses>
<InsertLoanResponse>
</InsertLoanResponse>
<InsertLoanResponse>
</InsertLoanResponse>
</InsertLoanResponses>
<ProcessingSummary>
<Failure></Failure>
<Success></Success>
</ProcessingSummary>
<InsertLoansResponse>
但我不想要复数InsertLoanResponses
根节点,我希望它看起来像这样:
<InsertLoansResponse>
<InsertLoanResponse>
</InsertLoanResponse>
<InsertLoanResponse>
</InsertLoanResponse>
<ProcessingSummary>
<Failure></Failure>
<Success></Success>
</ProcessingSummary>
<InsertLoansResponse>