public static DbTransaction Create(ISessionData session, CreateDatabaseConnectionDelegate create, IsolationLevel level) { DbTransaction t = new DbTransaction(); t._session = session; t._connection = create(); t._transaction = t.Connection.BeginTransaction(level); return(t); }
public SessionMiddleware(CreateDatabaseConnectionDelegate createdb, IHttpApplication app) { if (createdb == null || app == null) { throw new ArgumentNullException(); } _createDb = createdb; _app = app; using (IDbConnection connection = createdb()) using (IDbTransaction transaction = connection.BeginTransaction(IsolationLevel.Serializable)) using (IDbCommand cmd = connection.CreateCommand()) { cmd.CommandText = "DROP TABLE IF EXISTS SessionStateStore;"; cmd.ExecuteNonQuery(); cmd.CommandText = SQL_CREATE_TABLE; cmd.ExecuteNonQuery(); transaction.Commit(); } }
public SessionData(string id, CreateDatabaseConnectionDelegate create) { _id = id; _create = create; }