-
Notifications
You must be signed in to change notification settings - Fork 1
Connection reuse
Zev Spitz edited this page Mar 4, 2019
·
4 revisions
The standard use case is to have ConnectionFactory
return a new connection each time it is called, thus running each statement on its own connection. If you want to reuse the same connection, you have two choices:
-
Set the
ConnectionFactory
to return the same connection each time, instead of a new connectionusing (var conn = new OleDbConnection(connectionString)) { ConnectionFactory = () => conn; @"CREATE TABLE Persons ( ID COUNTER PRIMARY KEY, LastName TEXT, FirstName TEXT )".AsSql().Execute(); // ... }
-
Explicitly pass in the connection to the methods on
SqlString