Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在silverlight中使用wcf服务中的类-notifypropertychanged不';行不通_C#_Silverlight_Wcf_Inotifypropertychanged - Fatal编程技术网

C# 在silverlight中使用wcf服务中的类-notifypropertychanged不';行不通

C# 在silverlight中使用wcf服务中的类-notifypropertychanged不';行不通,c#,silverlight,wcf,inotifypropertychanged,C#,Silverlight,Wcf,Inotifypropertychanged,我正在wcf服务中定义以下类 public class Autoturism : INotifyPropertyChanged { private int _AutoturismID; public int AutoturismID { get { return _AutoturismID; } set { _AutoturismID = value; NotifyPropertyChanged("AutoturismID"); } }

我正在wcf服务中定义以下类

public class Autoturism : INotifyPropertyChanged
    {
        private int _AutoturismID;
        public int AutoturismID
        { get { return _AutoturismID; } set { _AutoturismID = value; NotifyPropertyChanged("AutoturismID"); } }

        private string _NumarAutoturism;
        public string NumarAutoturism
        { get { return _NumarAutoturism; } set { _NumarAutoturism = value; NotifyPropertyChanged("NumarAutoturism"); } }

        public bool IsDirty { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String info)
        {
            IsDirty = true;
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
我想使用IsDirty值来检查对象是否需要保存在数据库中

在silverlight页面中,我有以下几行:

AutoCurent = new Autoturism();
AutoCurent.NumarAutoturism="13424";
我的问题是,在最后一行之后,我希望IsDirty=true,但它仍然是false。我认为来自服务引用的Auoturim类不再具有NotifyPropertyChanged方法

我做错了什么?
谢谢

如果您使用的是RIAWCF服务(我必须从您的问题中假设),那么您的客户端版本的自动旅游对象将只具有服务端类中的属性,而不具有代码

基本上,riaservices为客户机创建的代理对象只具有相同的“形状”(但没有代码)


要完全共享代码和数据,需要将它们作为.shared.cs类。然后将完整的源代码复制到您的客户项目中。

谢谢,我很担心。我将搜索一些关于共享类+1的信息,以提供大量代码和良好的描述:)