In an ASP.NET 4.5 C # Entity Framework 5 Code First project, I would like to log changes made to the database at runtime (logging should be done in the asp.net application, not the database). Previously, SQL commands were created code, and these statements were simply logged. Now with EF, the object is retrieved via linq for objects modified and
db.SaveChanges();
. My first idea was to get the actual SQL statements that EF sends to the database - this seems rather complicated. I found many “solutions” for displaying SQL during debugging, but an easy way for code to not get it at runtime.
So, I'm looking for any solution that can log changes made (either SQL sent to the database [preferred], or some other form of textual representation of the changes made to the object), and that doesn't require the inclusion of several complex debug libraries.
source share