Exemplo n.º 1
0
        public PersistantList(PersistantStorageConnection connection, string collection, string database = null)
        {
            _connection = connection;
            if (string.IsNullOrEmpty(database))
            {
                database = connection.DefaultDatabase;
            }
            _db             = connection.GetDatabase(database);
            _collection     = connection.GetCollection <PersistantListElement <T> >(_db, collection);
            _collectionName = collection;
            _dbName         = database;

            var task = _collection.Find(x => true).ToListAsync();

            task.Wait();
            _localCache = task.Result;

            _asyncShed = new AsyncScheduler();

            _connection.AddTrackedList(_dbName, _collectionName, this);
        }