Ejemplo n.º 1
0
        public ISelector <T> ToSelector <T>(IDocumentSchema schema, IQueryableDocument mapping)
        {
            if (_selectionType == SelectionType.AsJson && _target == null)
            {
                return(new JsonSelector().As <ISelector <T> >());
            }

            if (_selectionType == SelectionType.AsJson && _target != null)
            {
                return(_target.ToJsonSelector <T>(mapping));
            }


            if (_selectionType == SelectionType.TransformToJson)
            {
                var transform = schema.TransformFor(_transformName);
                return(new TransformToJsonSelector(transform, mapping).As <ISelector <T> >());
            }

            if (_selectionType == SelectionType.TransformTo)
            {
                var transform = schema.TransformFor(_transformName);

                return(new TransformToTypeSelector <T>(transform, mapping));
            }

            if (_target == null || _target.Type != typeof(T))
            {
                return(new SingleFieldSelector <T>(mapping, _currentField.Members.Reverse().ToArray()));
            }

            return(_target.ToSelector <T>(mapping));
        }
Ejemplo n.º 2
0
        private void apply()
        {
            var transform = _schema.TransformFor(StoreOptions.PatchDoc);
            var document  = _schema.MappingFor(typeof(T)).ToQueryableDocument();
            var operation = new PatchOperation(transform, document, _fragment, Patch);

            _unitOfWork.Patch(operation);
        }
Ejemplo n.º 3
0
        private void apply()
        {
            var transform = _schema.TransformFor(StoreOptions.PatchDoc);
            var document  = _schema.MappingFor(typeof(T)).ToQueryableDocument();
            var operation = new PatchOperation(transform, document, _fragment, Patch);

            _unitOfWork.Patch(operation);

            if (document.DuplicatedFields.Any())
            {
                _unitOfWork.Add(operation.UpdateDuplicateFieldOperation());
            }
        }
Ejemplo n.º 4
0
        public ISelector <T> BuildSelector <T>(IDocumentSchema schema, IQueryableDocument document)
        {
            var transform = schema.TransformFor(_transformName);

            return(new TransformToTypeSelector <T>(transform, document));
        }
Ejemplo n.º 5
0
        public ISelector <T> BuildSelector <T>(string dataLocator, IDocumentSchema schema, IQueryableDocument document)
        {
            var transform = schema.TransformFor(_transformName);

            return(new TransformToJsonSelector(dataLocator, transform, document).As <ISelector <T> >());
        }