Search code examples
c#sqlmetal

C# SQLMetal generated code


Hei, SQLMetal generates code like this:

    [Column(Storage = "_specimen", DbType = "VarChar(100)")]
    public string Specimen
    {
        get
        {
            return this._specimen;
        }
        set
        {
            if ((this._specimen != value))
            {
                this.OnSpecimenChanging(value);
                this.SendPropertyChanging();
                this._specimen = value;
                this.SendPropertyChanged("specimen");
                this.OnSpecimenChanged();
            }
        }
    }

What are the OnSpecimenChanging and all those methods do? And does the specimen from thethis.SendPropertyChanged("specimen"); has to be allso capitalized or its not case sensitive?


Solution

  • It's hard to say what they do exactly without seeing any source code. SendPropertyChanged is most likely used to raise the PropertyChanged event, which will notify any subscribers to the event that a particular property has changed. The PropertyName string in PropertyChangedEventArgs is case sensitive, so the S will need to be capitalised.

    For more information:

    http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx

    http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanging.aspx