Пример #1
0
        protected PatcherOperationScope ApplySingleScript(DocumentsOperationContext context, Document document, bool isTestOnly, PatchRequest patch)
        {
            var run = new SingleScriptRun(this, context, patch, isTestOnly);

            try
            {
                run.Prepare(document?.Data?.Size ?? 0);
                SetupInputs(document, run.Scope, run.JintEngine);
                run.Execute();
                return(run.Scope);
            }
            catch (Exception errorEx)
            {
                run.HandleError(errorEx);
                throw;
            }
        }
Пример #2
0
        public bool TryResolveConflict(DocumentsOperationContext context, PatchRequest patch, out BlittableJsonReaderObject resolved)
        {
            var run = new SingleScriptRun(this, context, patch, false);

            try
            {
                run.Prepare(_docsSize);
                SetupInputs(run.Scope, run.JintEngine);
                run.Execute();

                return(TryParse(context, run.Scope, out resolved));
            }
            catch (Exception errorEx)
            {
                run.HandleError(errorEx);
                throw;
            }
        }