Beispiel #1
0
        /// <summary>
        /// Creates a new query manager over a database with the lock speicfied.
        /// </summary>
        /// <param name="database">The database to use.</param>
        /// <param name="databaseLock">The lock on the database to apply.</param>
        /// <param name="disposeDatabase">If the database should be disposed
        /// upon disposal of the QueryMaanger.</param>
        public QueryManager
        (
            IDatabase <TKey, TValue> database,
            SemaphoreSlim databaseLock,
            bool disposeDatabase = true
        )
        {
            _database        = database;
            _databaseLock    = databaseLock;
            _disposeDatabase = disposeDatabase;

            _trainEnumerable = _database.MakeTrainEnumerable
                               (
                value => new SimpleDatabaseValueRequest <TValue>(value, _databaseLock),
                databaseLock
                               );
        }
Beispiel #2
0
 public TrainEnumerator(TrainEnumerable <T> parent, int current, BigInteger index)
 {
     _parent  = parent;
     _current = current == -1 ? 0 : current;
     _index   = index;
 }