Exemplo n.º 1
0
        private IEnumerable <string> GetProperties(string completedPropertyPath)
        {
            var parsedPath = new RavenJPath(completedPropertyPath);

            var matchingProperties =
                recentDocuments.SelectMany(doc => GetPropertiesAtEndOfPath(doc, parsedPath)).Distinct();

            return(matchingProperties);
        }
        private IEnumerable <string> GetPropertiesAtEndOfPath(JsonDocument document, RavenJPath path)
        {
            var currentObject = document.DataAsJson.SelectToken(path);

            if (currentObject is RavenJObject)
            {
                return((currentObject as RavenJObject).Keys);
            }

            return(new string[0]);
        }
        private static Func <JsonDocument, object> CreateJPathDocumentExtractor(string binding)
        {
            try
            {
                var jpath = new RavenJPath(binding);

                return(doc => GetTokenValue(doc.DataAsJson.SelectToken(jpath)));
            }
            catch (Exception)
            {
                return(doc => "<<Invalid Binding Expression>>");
            }
        }
        private IEnumerable <string> GetProperties(string completedPropertyPath = "")
        {
            if (DocumentToSample != null)
            {
                return(GetPropertiesAtEndOfPath(DocumentToSample.Value));
            }

            if (RecentDocuments != null && RecentDocuments.Count > 0)
            {
                var parsedPath = new RavenJPath(completedPropertyPath);

                var matchingProperties = RecentDocuments.SelectMany(doc => GetPropertiesAtEndOfPath(doc, parsedPath)).Distinct();

                return(matchingProperties);
            }

            return(new string[0]);
        }