Esempio n. 1
0
        public void Finish(SessionRecord sessionRecord)
        {
            sessionRecord.FinishedAtUtc = DateTime.UtcNow;

            _conn.Execute(@"
update Sessions set IsActive = 1, FinishedAtUtc = @FinishedAtUtc where RowId = @RowId;
update Sessions set IsActive = 0 where RowId <> @RowId and IsActive = 1 and QueryName = @QueryName;
", sessionRecord);
        }
Esempio n. 2
0
        public SessionRecord Insert(SessionRecord record)
        {
            record.StartedAtUtc = DateTime.UtcNow;

            var rowId = _conn.Query <int>(
                "insert into Sessions(QueryName, IsActive, StartedAtUtc) values(@QueryName, 0, @StartedAtUtc); select last_insert_rowid()",
                record).Single();

            record.RowId = rowId;

            return(record);
        }