本文整理汇总了C#中QueryNode类的典型用法代码示例。如果您正苦于以下问题:C# QueryNode类的具体用法?C# QueryNode怎么用?C# QueryNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryNode类属于命名空间,在下文中一共展示了QueryNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: AnyTokenWithNonConstantExpressionNullParameter
public void AnyTokenWithNonConstantExpressionNullParameter()
{
this.expressionQueryNode = new UnaryOperatorNode(UnaryOperatorKind.Negate, new ConstantNode(false));
var binder = new LambdaBinder(this.FakeBindMethod);
var state = this.GetBindingStateForTest(HardCodedTestModel.GetPersonTypeReference(), HardCodedTestModel.GetPeopleSet());
var expression = new LiteralToken("foo");
var parent = new LiteralToken("bar");
var anyToken = new AnyToken(expression, null, parent);
var result = binder.BindLambdaToken(anyToken, state);
result.ShouldBeAnyQueryNode().And.Source.ShouldBeEntitySetQueryNode(HardCodedTestModel.GetPeopleSet());
result.Body.ShouldBeUnaryOperatorNode(UnaryOperatorKind.Negate);
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:13,代码来源:LambdaBinderTests.cs
示例17: TryBindToDeclaredAlternateKey
/// <summary>
/// Tries to bind key values to a key lookup on a collection.
/// </summary>
/// <param name="collectionNode">Already bound collection node.</param>
/// <param name="namedValues">The named value tokens to bind.</param>
/// <param name="model">The model to be used.</param>
/// <param name="collectionItemEntityType">The type of a single item in a collection to apply the key value to.</param>
/// <param name="keyLookupNode">The bound key lookup.</param>
/// <returns>Returns true if binding succeeded.</returns>
private bool TryBindToDeclaredAlternateKey(EntityCollectionNode collectionNode, IEnumerable<NamedValue> namedValues, IEdmModel model, IEdmEntityType collectionItemEntityType, out QueryNode keyLookupNode)
{
IEnumerable<IDictionary<string, IEdmProperty>> alternateKeys = model.GetAlternateKeysAnnotation(collectionItemEntityType);
foreach (IDictionary<string, IEdmProperty> keys in alternateKeys)
{
if (TryBindToKeys(collectionNode, namedValues, model, collectionItemEntityType, keys, out keyLookupNode))
{
return true;
}
}
keyLookupNode = null;
return false;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:23,代码来源:KeyBinder.cs
示例18: Bind
static string Bind(QueryNode node)
{
CollectionNode collectionNode = node as CollectionNode;
SingleValueNode singleValueNode = node as SingleValueNode;
if (singleValueNode != null)
{
switch (singleValueNode.Kind)
{
case Microsoft.OData.Core.UriParser.TreeNodeKinds.QueryNodeKind.EntityRangeVariableReference:
return BindRangeVariable((node as EntityRangeVariableReferenceNode).RangeVariable);
case Microsoft.OData.Core.UriParser.TreeNodeKinds.QueryNodeKind.SingleValuePropertyAccess:
return BindPropertyAccessQueryNode(node as SingleValuePropertyAccessNode);
default:
return string.Empty;
}
}
return string.Empty;
}
开发者ID:maskx,项目名称:OData,代码行数:18,代码来源:SQLOrderByBinder.cs
示例19: Compare
public bool Compare(QueryNode left, QueryNode right)
{
if (left.Kind != right.Kind)
return false;
switch (left.Kind)
{
case QueryNodeKind.Any:
return this.Compare((AnyNode)left, (AnyNode)right);
case QueryNodeKind.All:
return this.Compare((AllNode)left, (AllNode)right);
case QueryNodeKind.NonentityRangeVariableReference:
return this.Compare((NonentityRangeVariableReferenceNode)left, (NonentityRangeVariableReferenceNode)right);
case QueryNodeKind.Convert:
return this.Compare((ConvertNode)left, (ConvertNode)right);
case QueryNodeKind.BinaryOperator:
return this.Compare((BinaryOperatorNode)left, (BinaryOperatorNode)right);
case QueryNodeKind.UnaryOperator:
return this.Compare((UnaryOperatorNode)left, (UnaryOperatorNode)right);
case QueryNodeKind.SingleValueFunctionCall:
return this.Compare((SingleValueFunctionCallNode)left, (SingleValueFunctionCallNode)right);
case QueryNodeKind.SingleValuePropertyAccess:
return this.Compare((SingleValuePropertyAccessNode)left, (SingleValuePropertyAccessNode)right);
case QueryNodeKind.CollectionPropertyAccess:
return this.Compare((CollectionPropertyAccessNode)left, (CollectionPropertyAccessNode)right);
case QueryNodeKind.SingleEntityCast:
return this.Compare((SingleEntityCastNode)left, (SingleEntityCastNode)right);
case QueryNodeKind.EntityCollectionCast:
return this.Compare((EntityCollectionCastNode)left, (EntityCollectionCastNode)right);
case QueryNodeKind.EntityRangeVariableReference:
return this.Compare((EntityRangeVariableReferenceNode)left, (EntityRangeVariableReferenceNode)right);
case QueryNodeKind.Constant:
return this.Compare((ConstantNode)left, (ConstantNode)right);
case QueryNodeKind.CollectionNavigationNode:
return this.Compare((CollectionNavigationNode)left, (CollectionNavigationNode)right);
case QueryNodeKind.SingleNavigationNode:
return this.Compare((SingleNavigationNode)left, (SingleNavigationNode)right);
default:
throw new NotSupportedException(String.Format("Node kind not yet supported: {0}", left.Kind.ToString()));
}
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:41,代码来源:QueryNodeComparer.cs
示例20: ProcessNode
private object ProcessNode(QueryNode queryNode)
{
switch (queryNode.Kind)
{
case QueryNodeKind.Constant:
return ProcessConstant(queryNode as ConstantQueryNode);
case QueryNodeKind.EntitySet:
return ProcessNode(queryNode as EntitySetQueryNode);
case QueryNodeKind.OrderBy:
return ProcessNode(queryNode as OrderByQueryNode);
case QueryNodeKind.KeyLookup:
return ProcessKeyLookup(queryNode as KeyLookupQueryNode);
case QueryNodeKind.Skip:
return ProcessSkip(queryNode as SkipQueryNode);
case QueryNodeKind.Top:
return ProcessTop(queryNode as TopQueryNode);
case QueryNodeKind.PropertyAccess:
return ProcessNode(queryNode as PropertyAccessQueryNode);
case QueryNodeKind.Segment:
return ProcessNode(queryNode as NavigationPropertyNode);
default:
throw new NotImplementedException("No processing implemented for " + queryNode.Kind);
}
}
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:24,代码来源:SparqlGenerator.cs
注:本文中的QueryNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论