本文整理汇总了C#中QueryToken类的典型用法代码示例。如果您正苦于以下问题:C# QueryToken类的具体用法?C# QueryToken怎么用?C# QueryToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryToken类属于命名空间,在下文中一共展示了QueryToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindFilter
/// <summary>
/// Binds the given filter token.
/// </summary>
/// <param name="filter">The filter token to bind.</param>
/// <returns>A FilterNode with the given path linked to it (if provided).</returns>
internal FilterClause BindFilter(QueryToken filter)
{
ExceptionUtils.CheckArgumentNotNull(filter, "filter");
QueryNode expressionNode = this.bindMethod(filter);
SingleValueNode expressionResultNode = expressionNode as SingleValueNode;
if (expressionResultNode == null ||
(expressionResultNode.TypeReference != null && !expressionResultNode.TypeReference.IsODataPrimitiveTypeKind()))
{
throw new ODataException(ODataErrorStrings.MetadataBinder_FilterExpressionNotSingleValue);
}
// The type may be null here if the query statically represents the null literal or an open property.
IEdmTypeReference expressionResultType = expressionResultNode.TypeReference;
if (expressionResultType != null)
{
IEdmPrimitiveTypeReference primitiveExpressionResultType = expressionResultType.AsPrimitiveOrNull();
if (primitiveExpressionResultType == null ||
primitiveExpressionResultType.PrimitiveKind() != EdmPrimitiveTypeKind.Boolean)
{
throw new ODataException(ODataErrorStrings.MetadataBinder_FilterExpressionNotSingleValue);
}
}
FilterClause filterNode = new FilterClause(expressionResultNode, this.state.ImplicitRangeVariable);
return filterNode;
}
示例2: QueryTokenBuilder_SubTokensEvent
private List<QueryToken> QueryTokenBuilder_SubTokensEvent(QueryToken arg)
{
if (SubTokensEvent == null)
throw new InvalidOperationException("SubTokensEvent not set");
return SubTokensEvent(arg);
}
示例3: CountToken
internal CountToken(QueryToken parent)
: base(parent)
{
if (parent == null)
throw new ArgumentNullException("parent");
}
示例4: PropertyAccessQueryToken
/// <summary>
/// Create a PropertyAccessQueryToken given the name and the parent (if any)
/// </summary>
/// <param name="name">The name of the property to access.</param>
/// <param name="parent">The parent token to access the property on. Pass no if this property has no parent.</param>
public PropertyAccessQueryToken(string name, QueryToken parent)
{
ExceptionUtils.CheckArgumentStringNotNullOrEmpty(name, "name");
this.name = name;
this.parent = parent;
}
示例5: UnaryOperatorQueryToken
/// <summary>
/// Create a new UnaryOperatorQueryToken given the operator and operand
/// </summary>
/// <param name="operatorKind">The operator represented by this node.</param>
/// <param name="operand">The operand.</param>
public UnaryOperatorQueryToken(UnaryOperatorKind operatorKind, QueryToken operand)
{
ExceptionUtils.CheckArgumentNotNull(operand, "operand");
this.operatorKind = operatorKind;
this.operand = operand;
}
示例6: OrderByQueryToken
/// <summary>
/// Create a new OrderByQueryToken given the expression and direction
/// </summary>
/// <param name="expression">The expression according to which to order the results.</param>
/// <param name="direction">The direction of the ordering.</param>
public OrderByQueryToken(QueryToken expression, OrderByDirection direction)
{
ExceptionUtils.CheckArgumentNotNull(expression, "expression");
this.expression = expression;
this.direction = direction;
}
示例7: ToString
private static string ToString(QueryToken t)
{
if (t.Parts.Length == 1) { return t.Parts[0]; }
string str = "\"";
foreach (string part in t.Parts) { str += part + " "; }
return str.TrimEnd(' ') + "\"";
}
示例8: HasValueToken
internal HasValueToken(QueryToken parent)
: base(parent)
{
if (parent == null)
throw new ArgumentNullException("parent");
this.Priority = -1;
}
示例9: QueryTokenBuilderOrders_SubTokensEvent
private List<QueryToken> QueryTokenBuilderOrders_SubTokensEvent(QueryToken token)
{
var cr = (UserChartEntity)DataContext;
if (cr == null || QueryDescription == null)
return new List<QueryToken>();
return token.SubTokens(QueryDescription, SubTokensOptions.CanElement | (cr.GroupResults ? SubTokensOptions.CanAggregate : 0));
}
示例10: UpdateTokenList
private void UpdateTokenList(QueryToken queryToken)
{
if (queryToken == null)
tokens = new List<QueryToken>();
else
tokens = queryToken.Follow(a => a.Parent).Reverse().ToList();
UpdateCombo();
}
示例11: BagPropertyToken
internal BagPropertyToken(QueryToken parent, PropertyInfo pi)
: base(parent)
{
if (pi == null)
throw new ArgumentNullException("pi");
this.PropertyInfo = pi;
}
示例12: NavigationPropertyToken
/// <summary>
/// Create a new SegmentQueryToken given the name and parent and namedValues if any
/// </summary>
/// <param name="name">The name of the segment, the identifier.</param>
/// <param name="parent">The parent segment, or null if this is the root segment.</param>
/// <param name="namedValues">The named values in the key lookup for this segment.</param>
public NavigationPropertyToken(string name, QueryToken parent, IEnumerable<NamedValue> namedValues)
{
// We allow an "empty" name segment so we can create one for the case of a service-document URL (which has no path)
ExceptionUtils.CheckArgumentNotNull(name, "name");
this.name = name;
this.parent = parent;
this.namedValues = namedValues == null ? null : new ReadOnlyEnumerable<NamedValue>(namedValues);
}
示例13: BinaryOperatorQueryToken
/// <summary>
/// Create a new BinaryOperatorQueryToken given the operator, left and right query.
/// </summary>
/// <param name="operatorKind">The operator represented by this node.</param>
/// <param name="left">The left operand.</param>
/// <param name="right">The right operand.</param>
public BinaryOperatorQueryToken(BinaryOperatorKind operatorKind, QueryToken left, QueryToken right)
{
ExceptionUtils.CheckArgumentNotNull(left, "left");
ExceptionUtils.CheckArgumentNotNull(right, "right");
this.operatorKind = operatorKind;
this.left = left;
this.right = right;
}
示例14: EntityPropertyToken
internal EntityPropertyToken(QueryToken parent, PropertyInfo pi, PropertyRoute pr)
: base(parent)
{
if (pi == null)
throw new ArgumentNullException("pi");
this.PropertyInfo = pi;
this.PropertyRoute = pr;
}
示例15: CollectionElementToken
internal CollectionElementToken(QueryToken parent, CollectionElementType type)
: base(parent)
{
elementType = parent.Type.ElementType();
if (elementType == null)
throw new InvalidOperationException("not a collection");
this.CollectionElementType = type;
}