我的WCF服务是通过传入TimeFilter一个对象,返回一个TransactionTypeCollection对象
但是现在如果说传入TimeFilter对象返回的是一个空的TransactionTypeCollection对象,没错误,但是没有数据!WCF服务代码如下:
        [OperationContract]
        [XmlSerializerFormat]
        [ServiceKnownType(typeof(XmlElement))]
        [ServiceKnownType(typeof(EBaySubscriptionTypeCodeType))]
        [ServiceKnownType(typeof(TransactionTypeCollection))]
        [ServiceKnownType(typeof(TimeFilter))] 
        public TransactionTypeCollection myTransactionTypeCollection(TimeFilter tf)
        {
            Context = myContext();
            GetSellerTransactionsCall apicall2 = new GetSellerTransactionsCall(Context);
            apicall2.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            TransactionTypeCollection tran = apicall2.GetSellerTransactions(tf);
            return tran;
        }
 如果我改成
        public TransactionTypeCollection myTransactionTypeCollection(DateTime timeFrom,DateTime toTime)
        { ... }
 分别传两个DateTime 参数,这样就没问题!调用该服务的代码如下:
        {
            DateTime dt = DateTime.Now;
            tf.TimeFrom = dt.AddDays(-30);
            tf.TimeTo = dt;
            ebayWCF.myWCFClient ebay = new myWCFClient();
            ebay.myTransactionTypeCollectionCompleted += new  EventHandler<myTransactionTypeCollectionCompletedEventArgs>(ebay_myTransactionTypeCollectionCompleted);
            ebay.myTransactionTypeCollectionAsync(tf);
         }
          void ebay_myTransactionTypeCollectionCompleted(object sender, myTransactionTypeCollectionCompletedEventArgs e)
         {
            this.dg_info.ItemsSource = e.Result;
         }我想如何才能传一个对象就可以达到目的,因为其它的我要传对象去返回数据,我不可能把对象里这么多的属性做为参数全部传入,太多属性了!麻烦哪位高手解决啊,谢谢了!