如何将我的类上的重载构造函数传递给 WCF 客户端/消费者?
基本上,WCF 认为我的 B 类只有默认的、没有参数/空的构造函数。如何使客户端能够调用重载的构造函数?
public class A
{
public string MyField { get; set; }
}
public class B : A
{
public List<C> MyList { get; set; }
// when called on the WCF client side, MyList is null (so this constructor is not being called)
public B()
{
MyList = new List<C>();
}
// not available on WCF client side
public B(A a) : this()
{
base.MyField = a.MyField;
}
// not available on WCF client side
public void DoSomething()
{
// do stuff
}
}