Table Of Contents
Log SQL Queries
Sometimes you will want to log the SQL Queries issued by your application. The Sharp Factory Framework builds the queries dynamically at runtime.
We provided a way for you to intercept the SQL output and log it in which ever way you see fit. It is recommended to only turn on query logging during development, testing or, debugging a runtime issue.
During production query logging should be turned off unless really necessary.
The steps to setup query logging are as follows:
First create a C# method that takes these 2 parameters:
string sqlObject this will hold the name of the Table, View, Stored Procedure, Function or, Sequence being called.
string query this is the actual SQL query exactly how it was sent to the database.
The following code sample shows the signature of such method:
Second enable logging and hookup your method to the Database class.
Look at the code samples below: