Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanMarr committed May 17, 2024
2 parents 965234a + fe4a099 commit 67c340a
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 67c340a

Please sign in to comment.