47
我正在使用WCF Test Client(WcfTestClient.exe)來測試我的一個wcf服務。 我有具有DataContracts作爲列表的消息協定: 我的消息協定如下:如何在WCF Test Client(WcfTestClient.exe)中指定列表參數?
[MessageContract]
public class UpdateInvoiceStatusesRequest
{
private List<InvoiceStatusHistory> _invoiceStatusHistory;
[MessageBodyMember(Order = 0)]
public List<InvoiceStatusHistory> InvoiceStatusHistory
{
get { return _invoiceStatusHistory; }
set { _invoiceStatusHistory = value; }
}
}
和我的數據合同:
[DataContract]
public class InvoiceStatusHistory
{
private int _invoiceId;
private int _status;
private string _comment;
private string _timeStamp;
[DataMember]
public int InvoiceId
{
get { return _invoiceId; }
set { _invoiceId = value; }
}
[DataMember]
public string Comment
{
get { return _comment; }
set { _comment= value; }
}
[DataMember]
public int Status
{
get { return _status; }
set { _status = value; }
}
[DataMember]
public string TimeStamp
{
get { return _timeStamp; }
set { _timeStamp = value; }
}
}
當我使用WcfTestClient.exe到測試服務與UpdateInvoiceStatusesRequest
消息合同它顯示的價值InvoiceStatusHistory
長度= 0,現在我不知道如何添加InvoiceStatusHistory
在List<InvoiceStatusHistory>
對象? 有沒有人有任何想法,請幫助我?
非常感謝Darin。 – 2009-11-24 06:39:48
謝謝。我無法弄清楚。非直觀的。 :) – 2011-04-05 16:01:48
是的,在這裏我是2年後,仍然被這個困惑! – DanTheMan 2011-05-10 15:27:28