This is a migrated thread and some comments may be shown as answers.

Audit Object

1 Answer 64 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
önder
Top achievements
Rank 1
önder asked on 26 Nov 2015, 07:35 AM

Hi, 

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?

Regards

Thank you.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 27 Nov 2015, 03:10 PM
Please have a look at the code provided here: http://www.telerik.com/forums/audit-trail 
There we show how this can be achieved.

Regards,
Thomas
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
Development (API, general questions)
Asked by
önder
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Share this question
or