Implementing Audit Trail for Objects in C#?

前端 未结 5 2121
感动是毒
感动是毒 2020-12-29 15:02

I\'m looking for ideas on how to implement audit trails for my objects in C#, for the current project,basically I need to:

1.Store the old values and new values of a

5条回答
  •  执笔经年
    2020-12-29 15:17

    Have you considered using a simple notification pattern? You could have your service layer raise events such as NewObject, ChangedObject, DeletedObject that, will be listened to by a generic service layer which can then take the object and save the results.

    If you want to save the state of the object you could leverage Xml Serialization.

    Another approach is available if your using SQL Server 2008 you can implement the new Auditing features which will let you audit changes to database records you can even track (I think) when the data is read.

提交回复
热议问题