protected async Task <IReadOnlyList <Envelope> > afterExecutingAt(DateTimeOffset time) { var connection = new SqlConnection(ConnectionSource.ConnectionString); await connection.OpenAsync(); try { return(await theScheduledJob.ExecuteAtTime(connection, time)); } finally { connection.Dispose(); } }
protected async Task <IReadOnlyList <Envelope> > afterExecutingAt(DateTimeOffset time) { var connection = theStore.Tenancy.Default.CreateConnection(); await connection.OpenAsync(); var tx = connection.BeginTransaction(); using (var session = theStore.OpenSession(new SessionOptions { Transaction = tx, Tracking = DocumentTracking.None })) { var envelopes = await theScheduledJob.ExecuteAtTime(session, time); await tx.CommitAsync(); return(envelopes); } }