Esempio n. 1
0
            public IEnumerator <KeyValuePair <string, byte[]> > GetEnumerator(string tableName)
            {
                var op = ReifiedOperation.GetEnumerator <string, byte[]>(s => s.StartsWith(tableName, StringComparison.Ordinal));

                InvokeStartingOperationEvent(op);

                var res = (EnumerateOperationResult <string, byte[]>)op.Apply(ref _snapshot);

                _operations.Add(new Tuple <ReifiedOperation <string, byte[]>, OperationResult <string, byte[]> >(op, res));

                InvokeFinishedOperationEvent(op);

                if (res.Exception != null)
                {
                    throw res.Exception;
                }

                var len = tableName.Length;

                return
                    (new ProjectingEnumerator <KeyValuePair <string, byte[]>, KeyValuePair <string, byte[]> >(
                         (IEnumerator <KeyValuePair <string, byte[]> >)res.Result,
                         kvp => new KeyValuePair <string, byte[]>(
#if NET5_0 || NETSTANDARD2_1
                             kvp.Key[len..],
Esempio n. 2
0
            public void Remove(string tableName, string key)
            {
                var k  = GetInternalId(tableName, key);
                var op = ReifiedOperation.Remove <string, byte[]>(k);

                InvokeStartingOperationEvent(op);

                var res = (RemoveOperationResult <string, byte[]>)op.Apply(ref _snapshot);

                _operations.Add(new Tuple <ReifiedOperation <string, byte[]>, OperationResult <string, byte[]> >(op, res));

                InvokeFinishedOperationEvent(op);

                if (res.Exception != null)
                {
                    throw res.Exception;
                }
            }
Esempio n. 3
0
            public bool Contains(string tableName, string key)
            {
                var k  = GetInternalId(tableName, key);
                var op = ReifiedOperation.Contains <string, byte[]>(k);

                InvokeStartingOperationEvent(op);

                var res = (ContainsOperationResult <string, byte[]>)op.Apply(ref _snapshot);

                _operations.Add(new Tuple <ReifiedOperation <string, byte[]>, OperationResult <string, byte[]> >(op, res));

                InvokeFinishedOperationEvent(op);

                if (res.Exception != null)
                {
                    throw res.Exception;
                }

                return((bool)res.Result);
            }