public Task <ConditionalResult <T> > TryGetAsync <T>(Uri name) where T : IReliableState
        {
            IReliableState item;
            bool           result = this.store.TryGetValue(name, out item);

            return(Task.FromResult(ConditionalResultActivator.Create <T>(result, (T)item)));
        }
        public Task <ConditionalResult <TValue> > TryGetValueAsync(ITransaction tx, TKey key, TimeSpan timeout, CancellationToken cancellationToken)
        {
            TValue value;
            bool   result = this.dictionary.TryGetValue(key, out value);

            return(Task.FromResult(ConditionalResultActivator.Create <TValue>(result, value)));
        }
        public Task <ConditionalResult <TValue> > TryGetValueAsync(ITransaction tx, TKey key, LockMode lockMode)
        {
            TValue value;
            bool   result = this.dictionary.TryGetValue(key, out value);

            return(Task.FromResult(ConditionalResultActivator.Create <TValue>(result, value)));
        }
Beispiel #4
0
        public Task <ConditionalResult <T> > TryPeekAsync(ITransaction tx)
        {
            T    item;
            bool result = this.queue.TryPeek(out item);

            return(Task.FromResult(ConditionalResultActivator.Create <T>(result, item)));

            //return Task.FromResult(new ConditionalResult<T>(result, item));
        }
Beispiel #5
0
        public Task <ConditionalResult <T> > TryPeekAsync(ITransaction tx, TimeSpan timeout, CancellationToken cancellationToken)
        {
            T    item;
            bool result = this.queue.TryPeek(out item);

            return(Task.FromResult(ConditionalResultActivator.Create <T>(result, item)));

            //return Task.FromResult(new ConditionalResult<T>(result, item));
        }
        public Task <ConditionalResult <T> > TryGetAsync <T>(Uri name) where T : IReliableState
        {
            IReliableState result;
            bool           success = this.store.TryGetValue(name, out result);

            return(Task.FromResult(ConditionalResultActivator.Create <T>(success, (T)result)));

            //return Task.FromResult(new ConditionalResult<T>(success, (T) result));
        }