5

I modified my data source in my LINQ-to-SQL class (by the old delete and drag back in method), and was surprised to see the INotifyPropertyChanging & INotifyPropertyChanged interfaces no longer implemented in the generated classes (MyDb.designer.cs).

The methods for the individual fields went from looking like this...

[Column(Storage="_Size", DbType="NVarChar(100)")]
public string Size
{
    get
    {
        return this._Size;
    }
    set
    {
        if ((this._Size != value))
        {
            this.OnSizeChanging(value);
            this.SendPropertyChanging();
            this._Size = value;
            this.SendPropertyChanged("Size");
            this.OnSizeChanged();
        }
    }
}

To looking like this...

[Column(Storage="_Size", DbType="NVarChar(100)")]
public string Size
{
    get
    {
        return this._Size;
    }
    set
    {
        if ((this._Size != value))
        {
            this._Size = value;
        }
    }
}

Any ideas on why this happens and how it will affect my application?

Feckmore
  • 4,322
  • 6
  • 43
  • 51
  • That's strange. I don't know why it would happen. I do know, though, that without the INotifyPropertyChanged implementation, your DataContext won't be able to track any changes made to those entities. – rossisdead May 13 '10 at 20:44

4 Answers4

15

Make sure your table has a primary key.

Marek Stój
  • 4,075
  • 6
  • 49
  • 50
5

Check to make sure you did not set ObjectTrackingEnabled = false; or that you did not turn it off on the designer surface.

Adam
  • 3,014
  • 5
  • 33
  • 59
1

Adding primary key will resolve the problem.

Greatran
  • 180
  • 3
  • 18
0

Did you change something in the designer after drag and drop? IIRC, there is a tracked property or some such.

John Buchanan
  • 5,054
  • 2
  • 19
  • 17