You can put that method (OnValidateFieldValue) in the CommonEntityBase class (USER_REGION_CODE or partial class) and it will apply to all entities.
protected override bool OnValidateFieldValue(int fieldIndex, object value)
{
bool toReturn = true;
switch (this.Fields[fieldIndex].Name)
{
case"Datemodified":
// Check whether the entity is new or existing
this.SetValue(Fields["Datemodified"], DateTime.Now, true);
toReturn = true;
break;
default:
toReturn = true;
break;
}
return toReturn;
}
Similar, you can use:
- EntityBase.OnSave()
- DataAccesAdapterBase.OnSaveEntity()
You can also have a validator class and use it in all entities. See the documentation for Validators to see all the options to inject a Validator.
If you decide to refactor those columns in a new table called say "AuditInfo" then you add new records for each event, or just update some records of the LastUpdate, etc. In that case you could use Auditors.