Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Implementing Audit Trail using Entity Framework Part -1 [^]


Hi All,
I am using above link to implement Audit trail in my application. However, after I am facing two issues:-

1. Old Data is not being calculated since my entity is not of EntityObject Type, it is skipping the code and returning the null.

2. If i use same logic in following format, old value becomes equal to new value and thus correct values are not generated.

C#
foreach (ObjectStateEntry modifiedEntryEntity in modifiedEntities)
          {
              foreach (string modifiedProperty in modifiedEntryEntity.GetModifiedProperties())
              {
                  string originalValue = modifiedEntryEntity.OriginalValues[modifiedProperty].ToString();
                  string currentValue = modifiedEntryEntity.CurrentValues[modifiedProperty].ToString();
                  if (originalValue.Trim() == currentValue.Trim())
                  {
                      continue;
                  }

              }
          }
Posted
Comments
[no name] 7-May-12 8:27am    
And your question is what? How to contact the author of that article to ask them something?
[no name] 7-May-12 8:39am    
Question is how to get the original value?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900