windows phone linq to sql使用注意

c#写表结构的时候,在主键id的column()中一定要加入AutoSync = AutoSync.OnInsert, DbType = "INT NOT NULL Identity", CanBeNull = false, IsDbGenerated = true, IsPrimaryKey = true

     [Column]
        public double latitude
        {
            get { return _latitude; }
            set
            {
                if (_latitude != value)
                {
                    NotifyPropertyChanging("latitude");
                    _latitude = value;
                    NotifyPropertyChanged("latitude");
                }
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;
        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

此类信息,而不能让它为空,不然,submitchanges毫无作用

你可能感兴趣的:(windows,phone)