Exemple #1
0
        public override IOperationResult <T> GetResultWithValue()
        {
            var result = new DocumentFragment <T>(Builder);

            try
            {
                var status = GetResponseStatus();
                result.Success   = GetSuccess();
                result.Message   = GetMessage();
                result.Status    = GetParentStatus(status);
                result.Cas       = Header.Cas;
                result.Exception = Exception;

                CurrentSpec.Value  = GetValue();
                CurrentSpec.Status = status;
                result.Value       = new List <OperationSpec> {
                    CurrentSpec
                };

                // Read MutationToken after GetValue(), which may fill it with a value
                result.Token = MutationToken ?? DefaultMutationToken;

                //clean up and set to null
                if (!result.IsNmv())
                {
                    Data.Dispose();
                    Data = null;
                }
            }
            catch (Exception e)
            {
                result.Exception = e;
                result.Success   = false;
                result.Status    = ResponseStatus.ClientFailure;
            }
            finally
            {
                if (Data != null && !result.IsNmv())
                {
                    Data.Dispose();
                }
            }

            return(result);
        }
        public override IOperationResult <T> GetResultWithValue()
        {
            var result = new DocumentFragment <T>(Builder);

            try
            {
                result.Success   = GetSuccess();
                result.Message   = GetMessage();
                result.Status    = GetResponseStatus();
                result.Cas       = Header.Cas;
                result.Exception = Exception;
                result.Token     = MutationToken ?? DefaultMutationToken;
                result.Value     = GetCommandValues();

                //clean up and set to null
                if (!result.IsNmv())
                {
                    Data.Dispose();
                    Data = null;
                }
            }
            catch (Exception e)
            {
                result.Exception = e;
                result.Success   = false;
                result.Status    = ResponseStatus.ClientFailure;
            }
            finally
            {
                if (Data != null && !result.IsNmv())
                {
                    Data.Dispose();
                }
            }

            return(result);
        }