示例#1
0
        public ISelector <T> ToSelector <T>(string dataLocator, ITenant tenant, 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 = tenant.TransformFor(_transformName);
                return(new TransformToJsonSelector(dataLocator, transform, mapping).As <ISelector <T> >());
            }

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

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

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

            return(_target.ToSelector <T>(mapping, _distinct));
        }
示例#2
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));
        }
示例#3
0
        public ISelector <T> ToSelector <T>(IQueryableDocument mapping)
        {
            if (_isJson && _target == null)
            {
                return(new JsonSelector().As <ISelector <T> >());
            }

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


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

            return(_target.ToSelector <T>(mapping));
        }