I was wonder what would be the best way to log changes made to objects created by linq.
I have searched around and this is what i came up with:
using (testDBDataContext db = new testDBDataContext())
{
Sometable table = db.Sometables.Single(x => x.id == 1);
table.Something = txtTextboxToChangeValue.Text;
Sometable tableBeforeChanges = db.Sometables.GetOriginalEntityState(table);
foreach (System.Data.Linq.ModifiedMemberInfo item in db.Sometables.GetModifiedMembers(table))
{
// Obviously writing to debug is not what i would like to do
System.Diagnostics.Debug.WriteLine("Old value: " + item.OriginalValue.ToString());
System.Diagnostics.Debug.WriteLine("New value: " + item.CurrentValue.ToString());
}
}
Is this really the way to go to log changes?
Ive searched around and i think im gonna use DoodleAudit (doddleaudit.codeplex.com) it seems to give me what i wanted, tnx for helping anyways!