public void SaveObjects(IEntitySession session, IList <object> items) { //Schedule update query that will update all LastActiveOn columns for all sessions with ID in the hashset //We could use DateTime.Now as value for LastUsedOn for all sessions, it is within few seconds, but... // this causes problems for unit tests for session expiration, when we try to shift current time and see if session is expired; // (with current sessions would be updated to shifted time). So we keep actual time (latest) while we accumulate sessions for update var query = session.EntitySet <TUserSession>().Where(s => _sessionIds.Contains(s.Id)) .Select(s => new { Id = s.Id, LastUsedOn = _lastUsed }); session.ScheduleNonQuery <TUserSession>(query, Vita.Entities.Linq.LinqCommandType.Update); }