日期:2014-05-18  浏览次数:20840 次

WCF 契约相关...
C# code


[DataContract(Name = "LinkItem_Contract", Namespace = "http://schemas.thatindigogirl.com/samples/2006/06")]
    public class LinkItem
    {

        private long m_id;
        private string m_title;
        private string m_description;
        private DateTime m_dateStart;
        private DateTime m_dateEnd;
        private string m_url;

        [DataMember(Name = "Id_Contract", IsRequired = false, Order = 0)]
        public long Id
        {
            get { return m_id; }
            set { m_id = value; }
        }

        [DataMember(Name = "Title_Contract", IsRequired = true, Order = 1)]
        public string Title
        {
            get { return m_title; }
            set { m_title = value; }
        }
}

///调用

 LinkItem_Contract item = new LinkItem_Contract();

            item.Id_Contract = int.Parse(this.txtId.Text);
            item.Title_Contract = this.txtTitle.Text;



看到别人的例子中,有上面的用法,我想使用这种方式调用方法,但是提示报错的,怎么解决...

------解决方案--------------------
晕,报什么错也没说。
------解决方案--------------------
你压根没在用WCF的方法,只是用到了一个远程对象而已。