Search for existing suggestions

Built-in entity auditing!

EF should have some better data change tracking/auditing plumbing...on par with the extensive trace listener class support in ASP.NET. In order to create an audit history of the CRUD actions taking place within my entity model in EF 4.0, I had to write a lot of custom code and override the SavingChanges event and the OnContextCreated method to make it happen. Even now it doesn't properly catch all actions due to certain limitations (such as having DB-set identity fields). Think about how to make auditing data changes simpler and richer for devs!

22 votes
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Cory shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

4 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Marco Monducci commented  ·   ·  Flag as inappropriate

    Together will all the fabulous features you are introducing I think it could be find room also for a sort of Audit System more business oriented.
    We love the new Log & Interceptor hooks but we also need to pull out of the DbContext an easy POCO object based on 3 level of entities like this:

    (S)avedChangset (1 instance for every SaveChanges() call with at least Time, User, Application & Session Info)
    (E)ntities (a collection of the Entities changed within the same "Saved Changset" with at least TableName & PK)
    (A)ttributes (a collection of Attributes changed within the same "Entity", with at least ColumnName, old-data, new-data)
    Built with the aim to fill a three tables DB that will be the starting point for dozens of services just like deferred Publisher/Subscriber patterns, logging, tracing, audit and so on....

    and we don't love write hundreds of code lines inspecting the DbContext or some other structures, we would prefer to provide some delegates/functions/actions/what-you-prefer at static/constructor/design time to teach DbContext how to create our POCO class structure and, then, at runtime, pull out our well packaged SEA Audit Structur.

    Tons of other enhancements could be realized:
    like the optional mapping of this new structure with DbContext objects it-self in order to write the Audit Data into DB together with the BusinesData in the same transaction, and so on....

Feedback and Knowledge Base