Add the following extended property to your template:
Code: Select all
Code: Select all
bool propCallback = (bool) property.GetProperty("PropertyChangeCallback");Code: Select all
this._ = value;Code: Select all
                this.OnChanged();
Next, find the GenerateExtensibilityMethodDefinitions method and select the following section of code:
Code: Select all
    if (supportPropertyChanging) {
      string defaultNamespace = codeProvider.GetValidIdentifier(model.GetDefaultNamespace());
      foreach (HibernateProperty property in type.Properties ) {
#> 
        partial void OnChanging( value);
        partial void OnChanged();
 
        partial void OnChanging( value);
        partial void OnChanged();
 
        partial void OnChanging( value);
        partial void OnChanged();
 
        partial void OnChanging( value);
        partial void OnChanged();
<#+
        }
      }
    }
Code: Select all
        private string _Name;
        #region Extensibility Method Definitions
        
        partial void OnCreated();
        partial void OnNameChanged();
        
        #endregion
        protected internal virtual string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this._Name = value;
                this.OnNameChanged();
            }
        }
Also note that this is currently only implemented for scalar properties - not for navigation properties. You need it for navigation properties, you could probably follow this example and make the change yourself.
Hope this is useful to somebody else