Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 279217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:00:49+00:00 2026-05-12T05:00:49+00:00

I’m currently developing an ASP.NET Human Resources System. I’m using a layered architecture with

  • 0

I’m currently developing an ASP.NET Human Resources System. I’m using a layered architecture with Web Client Software Factory, which is based on MVP pattern. ORM is NHibernate. And I need to implement an Audit Log module. I’ve read a lot about different approaches. Most of them describe how to track date, timastamp and identity of person who made that change, but no one could tell me about that one: how to track changes of any property in my Domain layer? I don’t need any rollback capability, I need only Log with: who, when and what property of what object was changed, old value and new value of that property.

I can’t decide where to put the handler of this changes. Fowler pointed an Audit Log in setter method of properties, but I still want to keep my domain classes simple POCO`s. Maybe there is some other approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:00:50+00:00Added an answer on May 12, 2026 at 5:00 am

    I had to do this a few years back for an HR system as well. I accomplished it having all my ‘fields’ implement a template (generic):

    Here is an example of the template I made trimmed down:

    class DataField<T>
    {
        public T Current { get; set; }
        public T Original { get; set; }
        // stores the field name as a nice textual readable representation.
        // would default to property name if not defined.
        public string FieldName { get; set; }
        public bool Modified
        {
            get { return !(Current.Equals(Original));
        }
    
        public DataField(T value)
        {
            Original = Current = value;
        }
    
        public DataField(T value, T fieldName)
        {
            Original = Current = value;
            FieldName = fieldName;
        }
    }
    

    The interesting part about it that made auditting easy was that each object could produce it’s own audit log. I could take any object that could have x number of these ‘fields’ and call the GetAudit on it and it would return me an audit object with all the changes to the class showing the field name, old val, new val etc.. Each ‘DataField’ would implement a method to return an audit object. For strings, double, ints etc it was pretty much baked in but if you used custom objects you could write the audit implementation for them that just had to return a Audit object.

    So in a typical form at the end I would have all the data stored in one object that had all these types of fields. I would then do an update and call the GetAudit method which would also be written to an audit table as well.

    I could easily tell if anything had changed in the form even if they had to go through multiple pages etc.

    Undo’s were really easy on a field by field, section by section or the entire object level as well.

    Little foggy on the exact details as I haven’t touched the code in a long time but that was the gist of it. Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.