From fe4a09976a4abf2cb4e0e8741708e29309362c49 Mon Sep 17 00:00:00 2001 From: Jordan Marr Date: Mon, 6 May 2024 10:51:55 -0400 Subject: [PATCH] Consolidated readme logger example --- README.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b8ee0ed..d6ca956 100644 --- a/README.md +++ b/README.md @@ -286,20 +286,12 @@ let openContext() = let compiler = SqlKata.Compilers.SqlServerCompiler() let conn = new SqlConnection("Replace with your connection string") conn.Open() - new QueryContext(conn, compiler) -``` - -#### Query Logging - -You can, optionally, set a logger function that will be executed before a query is run. -This is a handy way to log queries and uses the same API as SqlKata: https://sqlkata.com/docs/execution/logging. -The function take a compiled query as a parameter and returns a unit. - -```F# let ctx = new QueryContext(conn, compiler) #if DEBUG - ctx.Logger <- printfn "SQL: %O" + // Writes your queries and parameters to the console + ctx.Logger <- printfn "SQL: %O" #endif + ctx ``` ### Select Builders