Audit Object

2 posts, 0 answers
  1. önder
    önder avatar
    1 posts
    Member since:
    Apr 2015

    Posted 26 Nov 2015 Link to this post


    We are using Telerik Data Access in web project.

    There is our purpose that the dbcontext object operations(insert, update,delete)   log in generic architecture.
    The function of db.context .hascahnges is aware of the changes and changes are transferred to lists as follow.

     if (dbContext.HasChanges)

                    var contextChanges = dbContext.GetChanges();
                    System.Collections.Generic.IList<object> allUpdates = contextChanges.GetUpdates<object>();
                    System.Collections.Generic.IList<object> allDeletes = contextChanges.GetDeletes<object>();

     We want to serialize  the object of the new and old state by foreach in  list and save in database.But our problem is that;

     state change properties take them one by one.

     foreach (var prop in obj.GetType().GetProperties())

    dbContext.GetOriginalValue<object>(item, prop.Name);// only prop  value but I want to object

    //if old value != new value


     How can I get the old object?


    Thank you.





  2. Thomas
    Thomas avatar
    588 posts

    Posted 27 Nov 2015 Link to this post

    Please have a look at the code provided here: 
    There we show how this can be achieved.

    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  3. DevCraft banner
Back to Top