.net - hint for audit log approach -


I am currently developing an ASP.NET Human Resource System. I am using a layered architecture with web client software factory, which is based on MVP pattern ORM is NHibernate and I have to implement the audit log module. I have read a lot about different approaches, most of them describe how to track the date, timestamp and identity of that change, but no one can tell me about it: any property in my domain layer How to track changes? I do not need any rollback capacity, I only have to log in with: who, when and when the object of which was changed, the old value and the new value of that property

I can not decide where to put handler of this change, the fauler points out an audit log in the setter system of properties, but I still want to keep my domain classes simple POCOs. What are some other approaches?

I had to do this a few years ago for the HR system. I've completed it that all my 'fields' apply a template (generic):

Here's an example of a template:

  class DataField & Lt; T & gt; {Turn on Public Tables {Get; Set; } Public T Basic {Received; Set; } / / Store the name of the field as a good text-readable representation. // Define if the name of the property will be default to the public string field name {get; Set; } Public Child Modified {get {return! (Present. Excel (original)); } Public DataField (T Value) {Original = Current = Value; } Public DataField (T Value, T Field Name) {Original = Current = Value; FieldName = fieldName; }}  

An interesting part about it is that it was easy to audit that each object can create its own audit log, I can pick up any object that is in the 'field' Get the number and call GetAudit on it and it will return the audit object to me with all the changes in the field shown in the field name, old wall, new wall etc. Each 'datafield' will apply a method to return an audit object. For strings, too much was baked in double, ints etc. But if you use custom objects, then you can write the audit implementation for them, which is to return the audit object.

In the end, I will have all the data stored in the same object, which were the fields of all these types. I will make an update and call the GetAudit method which will be written with the Audit Tables.

I can easily tell that anything has changed in the form even though they have multiple pages etc.

Undone from the field is also really easy by area, segment or whole object level.

A little blurred on exact details as I have not touched the code in a long time but it was the essence of it. Hope that helps


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -