我定义了以下方法:
[OperationContract]
[FaultContract(typeof(UserFriendlyError))]
bool MakeOutInvoice(Dictionary<string, string> pk, string usergid);
在我的网站中,我添加了服务参考,vs 2010 在下面生成了这些代码:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays")]
public partial class ArrayOfKeyValueOfstringstringKeyValueOfstringstring : object, System.ComponentModel.INotifyPropertyChanged {
private string keyField;
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=0)]
public string Key {
get {
return this.keyField;
}
set {
this.keyField = value;
this.RaisePropertyChanged("Key");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=1)]
public string Value {
get {
return this.valueField;
}
set {
this.valueField = value;
this.RaisePropertyChanged("Value");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
public bool MakeOutInvoice(ArrayOfKeyValueOfstringstringKeyValueOfstringstring[] pk, string usergid) {
LPM.Web.LPTMSFinancialServiceRef.MakeOutInvoiceRequest inValue = new LPM.Web.LPTMSFinancialServiceRef.MakeOutInvoiceRequest();
inValue.pk = pk;
inValue.usergid = usergid;
LPM.Web.LPTMSFinancialServiceRef.MakeOutInvoiceResponse retVal = ((LPM.Web.LPTMSFinancialServiceRef.ILPTMSFinancialService)(this)).MakeOutInvoice(inValue);
return retVal.MakeOutInvoiceResult;
}
在我看来,它应该生成与 WCF 相同的参数。为什么它用字典代替生成新的类型参数?谢谢你的帮助!