Last active
May 3, 2016 18:17
-
-
Save jfbueno/740f078eb85fb79b525b4cc07dc08423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DatabaseLogger | |
{ | |
public static void Log(string query) | |
{ | |
var words = query.Split(' '); | |
if (words.FirstOrDefault()?.ToUpper() == "UPDATE") | |
{ | |
//aqui salva o log de update | |
} | |
} | |
} | |
//Lá no contexto | |
public DatabaseContext : DbContext | |
{ | |
public DatabaseContext() : base("Connstring") | |
{ | |
Database.Log = (message) => DatabaseLogger.Log(message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment