[英]List variable is not getting exposed from WCF Service
I am writing a WCF Service which exposed the parameter Pin, gender and addresses. 我正在写一个WCF服务,它公开了参数Pin,性别和地址。 I am consuming the service using WCF Client.
我正在使用WCF客户端使用该服务。 In the Client I can see only the simple parameters Pin and gender.
在客户端中,我只能看到简单的参数Pin和gender。 I could not see the
List<PatronAddress>
. 我看不到
List<PatronAddress>
。 I have added [DataContract]
and [DataMember]
for the patron address class. 我为顾客地址类添加了
[DataContract]
和[DataMember]
。 Can some one let me know how to expose the List from WCF? 可以让我知道如何从WCF中公开列表吗? Thanks.
谢谢。
Code is below. 代码如下。
[DataContract]
public class EnrollPatronInformation
{
[DataMember]
public string Pin { get; set; }
[DataMember]
public enums.eGenderType Gender { get; set; }
[DataMember]
public List<PatronAddress> Address { get; set; }
}
[DataContract]
public class PatronAddress
{
[DataMember]
public string ContactType { get; set; }
[DataMember]
public string Line1 { get; set; }
[DataMember]
public string Line2 { get; set; }
[DataMember]
public string Country { get; set; }
[DataMember]
public string Postal { get; set; }
[DataMember]
public string City { get; set; }
[DataMember]
public string State { get; set; }
}
Since it is output field use Array for it. 由于它是输出字段,因此请使用Array。 You don't need to provide a List to a client.
您无需向客户提供列表。 For Arrays it usually works
对于数组,通常可以使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.