Need do changes on template file for NHibernate entity

Jul 5, 2009 at 1:04 PM

Hi,

Thank you very much for this flexible tool, I am also enjoying it in our project.

There comes one problem. recently, our project has a new requirement---Record everything changes of DB, that mean, I need fetch properties name and it's value change history from entity.

e.g. Property Name: "Id",  Old value: 1, New value 2.

So I found the code generate by sculpture is not convenient for this situation. So I want do some changes like below:

set
            {
                if (this._createBy != value)
                {
                    this.OnCreateByChanging(value);
                    this.SendPropertyChanging("CreateBy", _createBy);
                    this._createBy = value;
                    this.SendPropertyChanged("CreateBy", value);
                    this.OnCreateByChanged();
                    if (this._entityState == EntityState.Unchanged)
                        this._entityState = EntityState.Changed;
                }
            }

I send property name and value before and after changes to method, which will record change in a dictionary( I also thought use reflect to get value, but for weak of performance, I denied it)

Would you kindly give me some suggestion or tell me how to change template file?

 

Regards

Dio yu