当前位置: 首页>>代码示例>>C#>>正文


C# QueryNode类代码示例

本文整理汇总了C#中QueryNode的典型用法代码示例。如果您正苦于以下问题:C# QueryNode类的具体用法?C# QueryNode怎么用?C# QueryNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


QueryNode类属于命名空间,在下文中一共展示了QueryNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAndVerifyStatusCode

 public static void GetAndVerifyStatusCode(Workspace w, QueryNode query, HttpStatusCode expectedStatusCode)
 {
     AstoriaRequest request = w.CreateRequest(query);
     request.ExpectedStatusCode = expectedStatusCode;
     AstoriaResponse response = request.GetResponse();
     ResponseVerification.VerifyStatusCode(response);
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:7,代码来源:RequestUtil.cs

示例2: GetHighlightResultsNode

 public GetHighlightResultsNode(QueryNode sourceNode, string preTag, string postTag, bool mergeHighlights)
 {
     this.SourceNode = sourceNode;
     this.PreTag = preTag;
     this.PostTag = postTag;
     this.MergeHighlights = mergeHighlights;
 }
开发者ID:jscott1277,项目名称:SitecoreAzureSearchProvider,代码行数:7,代码来源:GetHighlightsNode.cs

示例3: Bind

        protected string Bind(QueryNode node)
        {
            CollectionNode collectionNode = node as CollectionNode;
            SingleValueNode singleValueNode = node as SingleValueNode;

            if (collectionNode != null)
            {
                switch (node.Kind)
                {
                    case QueryNodeKind.CollectionNavigationNode:
                        CollectionNavigationNode navigationNode = node as CollectionNavigationNode;
                        return BindNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty);

                    case QueryNodeKind.CollectionPropertyAccess:
                        return BindCollectionPropertyAccessNode(node as CollectionPropertyAccessNode);
                }
            }
            else if (singleValueNode != null)
            {
                switch (node.Kind)
                {
                    case QueryNodeKind.BinaryOperator:
                        return BindBinaryOperatorNode(node as BinaryOperatorNode);

                    case QueryNodeKind.Constant:
                        return BindConstantNode(node as ConstantNode);

                    case QueryNodeKind.Convert:
                        return BindConvertNode(node as ConvertNode);

                    case QueryNodeKind.EntityRangeVariableReference:
                        return BindRangeVariable((node as EntityRangeVariableReferenceNode).RangeVariable);

                    case QueryNodeKind.NonentityRangeVariableReference:
                        return BindRangeVariable((node as NonentityRangeVariableReferenceNode).RangeVariable);

                    case QueryNodeKind.SingleValuePropertyAccess:
                        return BindPropertyAccessQueryNode(node as SingleValuePropertyAccessNode);

                    case QueryNodeKind.UnaryOperator:
                        return BindUnaryOperatorNode(node as UnaryOperatorNode);

                    case QueryNodeKind.SingleValueFunctionCall:
                        return BindSingleValueFunctionCallNode(node as SingleValueFunctionCallNode);

                    case QueryNodeKind.SingleNavigationNode:
                        SingleNavigationNode navigationNode = node as SingleNavigationNode;
                        return BindNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty);

                    case QueryNodeKind.Any:
                        return BindAnyNode(node as AnyNode);

                    case QueryNodeKind.All:
                        return BindAllNode(node as AllNode);
                }
            }

            throw new NotSupportedException(String.Format("Nodes of type {0} are not supported", node.Kind));
        }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:59,代码来源:NHibernateFilterBinder.cs

示例4: WithinRadiusNode

 public WithinRadiusNode(QueryNode sourceNode, string field, double lat, double lon, int radius)
 {
     this.SourceNode = sourceNode;
     this.Field = field;
     this.Lat = lat;
     this.Lon = lon;
     this.Radius = radius;
 }
开发者ID:Igentics,项目名称:sitecore-solr-spatial,代码行数:8,代码来源:WithinRadiusNode.cs

示例5: TopNode

        /// <summary>
        /// Creates a <see cref="TopNode"/>.
        /// </summary>
        /// <param name="amount">The number of entities to include in the result.</param>
        /// <param name="collection">The collection to take items from.</param>
        public TopNode(QueryNode amount, CollectionNode collection)
        {
            ExceptionUtils.CheckArgumentNotNull(amount, "amount");
            ExceptionUtils.CheckArgumentNotNull(collection, "collection");

            this.amount = amount;
            this.collection = collection;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:TopNode.cs

示例6: AddNode

 protected void AddNode (QueryNode node)
 {
     if (node is QueryTermNode) {
         QueryTermBox box = first_add_node ? FirstRow : CreateRow (true);
         box.QueryNode = node as QueryTermNode;
         first_add_node = false;
     } else {
         throw new ArgumentException ("Query is too complex for GUI query editor", "node");
     }
 }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:10,代码来源:QueryTermsBox.cs

示例7: ReplaceChild

        public void ReplaceChild(QueryNode old_child, QueryNode new_child)
        {
            int index = children.IndexOf(old_child);
            if(index < 0) {
                throw new ApplicationException("old_child does not exist");
            }

            children.RemoveAt(index);
            children.Insert(index, new_child);
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:10,代码来源:QueryListNode.cs

示例8: TryBindIdentifier

        internal static bool TryBindIdentifier(string identifier, IEdmEnumTypeReference typeReference, IEdmModel modelWhenNoTypeReference, out QueryNode boundEnum)
        {
            boundEnum = null;
            string text = identifier;

            // parse the string, e.g., NS.Color'Green'
            // get type information, and also convert Green into an ODataEnumValue

            // find the first ', before that, it is namespace.type
            int indexOfSingleQuote = text.IndexOf('\'');
            if (indexOfSingleQuote < 0)
            {
                return false;
            }

            string namespaceAndType = text.Substring(0, indexOfSingleQuote);
            Debug.Assert((typeReference == null) || (modelWhenNoTypeReference == null), "((typeReference == null) || (modelWhenNoTypeReference == null)");

            // validate typeReference but allow type name not found in model for delayed throwing.
            if ((typeReference != null) && !string.Equals(namespaceAndType, typeReference.ODataFullName()))
            {
                return false;
            }

            // get the type
            IEdmEnumType enumType = typeReference != null
                ?
               (IEdmEnumType)typeReference.Definition
                :
                UriEdmHelpers.FindEnumTypeFromModel(modelWhenNoTypeReference, namespaceAndType);
            if (enumType == null)
            {
                return false;
            }

            // now, find out the value
            UriPrimitiveTypeParser.TryRemovePrefix(namespaceAndType, ref text);
            UriPrimitiveTypeParser.TryRemoveQuotes(ref text);

            // parse string or int value to edm enum value
            string enumValueString = text;
            ODataEnumValue enumValue;

            if (!TryParseEnum(enumType, enumValueString, out enumValue))
            {
                return false;
            }

            // create an enum node, enclosing an odata enum value
            IEdmEnumTypeReference enumTypeReference = typeReference ?? new EdmEnumTypeReference(enumType, false);
            boundEnum = new ConstantNode(enumValue, identifier, enumTypeReference);

            return true;
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:54,代码来源:EnumBinder.cs

示例9: Find

        public void Find(QueryNode node)
        {
            switch (node.Kind)
            {
                case QueryNodeKind.All:
                case QueryNodeKind.Any:
                    var l = (LambdaNode)node;
                    Find(l.Source);
                    Find(l.Body);
                    break;
                case QueryNodeKind.BinaryOperator:
                    var bo = (BinaryOperatorNode)node;
                    Find(bo.Left);
                    addPath();
                    Find(bo.Right);
                    break;

                case QueryNodeKind.Convert:
                    Find(((ConvertNode)node).Source);
                    break;
                case QueryNodeKind.NonentityRangeVariableReference:
                case QueryNodeKind.UnaryOperator:
                    var uo = (UnaryOperatorNode)node;
                    Find(uo.Operand);
                    break;

                case QueryNodeKind.SingleValuePropertyAccess:
                    var sv = (SingleValuePropertyAccessNode)node;
                    Find(sv.Source);
                    break;
                /*
            case QueryNodeKind.CollectionPropertyAccess:
            var cpa = (CollectionPropertyAccessNode)node;
            Paths[Paths.Count-1] += '.' + cpa.Property.Name;
            break;
                                    */
                case QueryNodeKind.CollectionNavigationNode:
                    var cnn = (CollectionNavigationNode)node;
                    Find(cnn.Source);
                    AddNav(cnn.NavigationProperty.Name);
                    break;
                case QueryNodeKind.SingleNavigationNode:
                    var snn = (SingleNavigationNode)node;
                    AddNav(snn.NavigationProperty.Name);
                    break;
                //case QueryNodeKind.SingleValueOpenPropertyAccess:
                //case QueryNodeKind.SingleEntityCast:

                //case QueryNodeKind.EntityCollectionCast:
                case QueryNodeKind.NamedFunctionParameter:
                    Console.WriteLine(node.GetType());
                    break;
            }
        }
开发者ID:mcshaz,项目名称:SimPlanner,代码行数:54,代码来源:FindAnyAllFilterOptions.cs

示例10: ToString

        public static string ToString(QueryNode node)
        {
            if (node == null) return String.Empty;

            switch (node.Kind)
            {
                case QueryNodeKind.Any:
                    return ToString((AnyNode)node);
                case QueryNodeKind.All:
                    return ToString((AllNode)node);
                case QueryNodeKind.NonentityRangeVariableReference:
                    return ToString((NonentityRangeVariableReferenceNode)node);
                case QueryNodeKind.Convert:
                    return ToString((ConvertNode)node);
                case QueryNodeKind.BinaryOperator:
                    return ToString((BinaryOperatorNode)node);
                case QueryNodeKind.UnaryOperator:
                    return ToString((UnaryOperatorNode)node);
                case QueryNodeKind.SingleValueFunctionCall:
                    return ToString((SingleValueFunctionCallNode)node);
                case QueryNodeKind.SingleValuePropertyAccess:
                    return ToString((SingleValuePropertyAccessNode)node);
                case QueryNodeKind.CollectionPropertyAccess:
                    return ToString((CollectionPropertyAccessNode)node);
                case QueryNodeKind.CollectionOpenPropertyAccess:
                    return ToString((CollectionOpenPropertyAccessNode)node);
                case QueryNodeKind.SingleEntityCast:
                    return ToString((SingleEntityCastNode)node);
                case QueryNodeKind.EntityCollectionCast:
                    return ToString((EntityCollectionCastNode)node);
                case QueryNodeKind.EntityRangeVariableReference:
                    return ToString((EntityRangeVariableReferenceNode)node);
                case QueryNodeKind.Constant:
                    return ToString((ConstantNode)node);
                case QueryNodeKind.CollectionNavigationNode:
                    return ToString((CollectionNavigationNode)node);
                case QueryNodeKind.SingleNavigationNode:
                    return ToString((SingleNavigationNode)node);
                case QueryNodeKind.SingleEntityFunctionCall:
                    return ToString((SingleEntityFunctionCallNode)node);
                case QueryNodeKind.NamedFunctionParameter:
                    return ToString((NamedFunctionParameterNode)node);
                case QueryNodeKind.ParameterAlias:
                    return ToString((ParameterAliasNode)node);
                case QueryNodeKind.SearchTerm:
                    return ToString((SearchTermNode)node);
                case QueryNodeKind.CollectionPropertyCast:
                    return ToString((CollectionPropertyCastNode)node);
                case QueryNodeKind.SingleValueCast:
                    return ToString((SingleValueCastNode)node);
                default:
                    throw new NotSupportedException(String.Format("Node kind not yet supported: {0}", node.Kind.ToString()));
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:54,代码来源:QueryNodeToStringVisitor.cs

示例11: Visit

 protected override AbstractSolrQuery Visit(QueryNode node, SolrQueryMapperState state)
 {
     if (node.NodeType == QueryNodeType.Custom)
     {
         if (node is WithinRadiusNode)
         {
             return VisitWithinRadius((WithinRadiusNode)node, state);
         }
     }
     return base.Visit(node, state);
 }
开发者ID:Igentics,项目名称:sitecore-solr-spatial,代码行数:11,代码来源:SolrSpatialQueryMapper.cs

示例12: AllTokenWithNonEntityCollectionParentNonConstantExpression

        public void AllTokenWithNonEntityCollectionParentNonConstantExpression()
        {
            this.parentQueryNode = new CollectionPropertyAccessNode(new ConstantNode(null), HardCodedTestModel.GetDogNicknamesProperty());
            this.expressionQueryNode = new BinaryOperatorNode(BinaryOperatorKind.LessThanOrEqual, new ConstantNode(1), new ConstantNode(5));
            var binder = new LambdaBinder(this.FakeBindMethod);
            var state = this.GetBindingStateForTest(HardCodedTestModel.GetPersonTypeReference(), HardCodedTestModel.GetPeopleSet());
            var allToken = this.CreateTestAllQueryToken();

            var result = binder.BindLambdaToken(allToken, state);
            result.ShouldBeAllQueryNode().And.Source.ShouldBeCollectionPropertyAccessQueryNode(HardCodedTestModel.GetDogNicknamesProperty());
            result.Body.ShouldBeBinaryOperatorNode(BinaryOperatorKind.LessThanOrEqual);
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:12,代码来源:LambdaBinderTests.cs

示例13: Visit

        protected override QueryNode Visit(QueryNode node, SolrQueryOptimizerState state)
        {
            if (node.NodeType == QueryNodeType.Custom)
            {
                if (node is WithinRadiusNode)
                {
                    return VisitWithinRadius((WithinRadiusNode)node, state);
                }
            }

            return base.Visit(node, state);
        }
开发者ID:Igentics,项目名称:sitecore-solr-spatial,代码行数:12,代码来源:SpatialSolrQueryOptimizer.cs

示例14: VerifyQueryNodesAreEqual

        public static void VerifyQueryNodesAreEqual(QueryNode expected, QueryNode actual, AssertionHandler assert)
        {
            try
            {
                if (expected == null)
                {
                    assert.IsNull(actual, "The node should be null.");
                    return;
                }
                else
                {
                    assert.IsNotNull(actual, "The node should not be null.");
                }

                assert.AreEqual(expected.InternalKind, actual.InternalKind, "The node kind differs from expected one.");
                switch (expected.InternalKind)
                {
                    case InternalQueryNodeKind.Constant:
                        VerifyConstantQueryNodesAreEqual((ConstantNode)expected, (ConstantNode)actual, assert);
                        break;
                    case InternalQueryNodeKind.Convert:
                        VerifyConvertQueryNodesAreEqual((ConvertNode)expected, (ConvertNode)actual, assert);
                        break;
                    case InternalQueryNodeKind.NonentityRangeVariableReference:
                        VerifyNonentityRangeVariableReferenceNodesAreEqual((NonentityRangeVariableReferenceNode) expected, (NonentityRangeVariableReferenceNode) actual,assert);
                        break;
                    case InternalQueryNodeKind.EntityRangeVariableReference:
                        VerifyEntityRangeVariableReferenceNodesAreEqual((EntityRangeVariableReferenceNode)expected, (EntityRangeVariableReferenceNode)actual, assert);
                        break;
                    case InternalQueryNodeKind.BinaryOperator:
                        VerifyBinaryOperatorQueryNodesAreEqual((BinaryOperatorNode)expected, (BinaryOperatorNode)actual, assert);
                        break;
                    case InternalQueryNodeKind.UnaryOperator:
                        VerifyUnaryOperatorQueryNodesAreEqual((UnaryOperatorNode)expected, (UnaryOperatorNode)actual, assert);
                        break;
                    case InternalQueryNodeKind.SingleValuePropertyAccess:
                        VerifyPropertyAccessQueryNodesAreEqual((SingleValuePropertyAccessNode)expected, (SingleValuePropertyAccessNode)actual, assert);
                        break;
                    case InternalQueryNodeKind.SingleValueFunctionCall:
                        VerifySingleValueFunctionCallQueryNodesAreEqual((SingleValueFunctionCallNode)expected, (SingleValueFunctionCallNode)actual, assert);
                        break;
                    default:
                        throw new Exception("Query node of kind '" + expected.InternalKind.ToString() + "' not yet supported by VerifyQueryNodesAreEqual.");
                }
            }
            catch (Exception)
            {
                assert.Warn("Expected query node: " + expected.ToDebugString());
                assert.Warn("Actual query node: " + actual.ToDebugString());
                throw;
            }
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:52,代码来源:QueryNodeUtils.cs

示例15: ArgumentsAreSetCorrectly

 public void ArgumentsAreSetCorrectly()
 {
     QueryNode[] args = new QueryNode[]
         {
             new ConstantNode(1),
             new ConstantNode(2),
             new ConstantNode(3),
             new ConstantNode(4),
             new ConstantNode(5) 
         };
     SingleValueFunctionCallNode singleValueFunction = new SingleValueFunctionCallNode("stuff", args, EdmCoreModel.Instance.GetInt32(true));
     singleValueFunction.Parameters.Should().BeEquivalentTo(args);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:SingleValueFunctionCallNodeTests.cs


注:本文中的QueryNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。