我定义了以下方法:

    [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相同的参数。 为什么用Dictionary代替生成新类型参数? 谢谢你的帮助!

  ask by Roger Dai translate from so

本文未有回复,本站智能推荐: