vendredi 3 juillet 2015

SqliteConnection Trace event refuses to fire

I have used NUGET to install the Sqlite Core package into my c# project using:

>Install-Package System.Data.SQLite.Core

I create a database connection as follows:

var data = new SQLiteConnection(connectionString);

I then hook an event handler to the update event which fires every time that an update statement occurs (for the purposes of a last write date field for a particular piece of business logic)

data.Update += DataOnUpdate;

This is all awesome. However the SqliteConnection class also exposes an event called Trace The documentation says the following about this event:

"This event is raised whenever SQLite Statement First begins executing on this connection. It only applies for the given connection"

I read this to mean that it performs a similar function to the Update event whereby it should fire whenever an SQL statement is being executed.

HOWEVER

When I hook this event up as follows:

data.Trace += DataOnTrace;

It never fires. I have tried SELECT, UPDATE, DELETE, CREATE TABLE, TRANSACTIONS and basically every bit of Sql logic that I can think of and it refuses to fire.

What is this event there for if not to fire? or is there something I need to do to get the connection to fire this event?

Aucun commentaire:

Enregistrer un commentaire