Ejemplo n.º 1
0
        protected void SetupInputs(PatcherOperationScope scope, Engine jintEngine)
        {
            var docsArr = jintEngine.Array.Construct(Arguments.Empty);
            int index   = 0;

            foreach (var doc in _docs)
            {
                //TODO : add unit test that has a conflict here to make sure that it is ok
                var jsVal = scope.ToJsObject(jintEngine, doc.Doc, "doc" + index);
                docsArr.FastAddProperty(index.ToString(), jsVal, true, true, true);
                index++;
            }
            docsArr.FastSetProperty("length", new PropertyDescriptor
            {
                Value        = new JsValue(index),
                Configurable = true,
                Enumerable   = true,
                Writable     = true,
            });

            scope.PatchObject = docsArr;
        }
Ejemplo n.º 2
0
 protected void SetupInputs(Document document, PatcherOperationScope scope, Engine jintEngine)
 {
     jintEngine.SetValue("__document_id", document.Key);
     scope.PatchObject = scope.ToJsObject(jintEngine, document.Data);
 }