public NavigationExpression(QueryNode input, PropertyExpression property, bool isLink) : base(input) { _isLink = isLink; _property = property; }
//DML public static ProjectExpression Select(this QueryNode input, params ExpNode[] projection) { return(new ProjectExpression(input, projection)); }
public NavigationExpression(QueryNode input, PropertyExpression property) : this(input, property, false) { }
public static OrderByExpression Sort(this QueryNode input, ExpNode[] properties, bool bAscDesc) { return(Sort(input, properties, bAscDesc, false)); }
//Constructor public SingleExpression(QueryNode input, ResourceType resourceType) : base(input) { _resourceType = resourceType; }
//Constructor public CountExpression(QueryNode input, string countKind, QueryNode scannode) : base(input) { _countKind = countKind; _scannode = scannode; }
public OrderByExpression(QueryNode input, ExpNode[] properties, QueryNode scannode, bool bAscDesc) : this(input, properties, scannode, bAscDesc, false) { }
public static PredicateExpression Where(this QueryNode input, ExpNode predicate) { return(new PredicateExpression(input, predicate)); }
public static FirstOrDefaultExpression FirstOrDefault(this QueryNode input, ResourceType resourceType) { return(new FirstOrDefaultExpression(input, resourceType)); }
public static QueryNode ExpandIfApplicable(this QueryNode input, PropertyExpression[] properties, bool applicable) { return(applicable ? Expand(input, properties) : input); }
public static OfTypeExpression OfType(this QueryNode input, ResourceType resourceType) { return(new OfTypeExpression(input, resourceType)); }
public static QueryOptionExpression QueryOption(this QueryNode input, string optionName, string value) { return(new QueryOptionExpression(input, optionName, value)); }
public static NavigationExpression Nav(this QueryNode input, PropertyExpression property, bool isLink) { return(new NavigationExpression(input, property, isLink)); }
public static NewExpression New(this QueryNode input, params ExpNode[] members) { return(new NewExpression(input, members)); }
public ExpandExpression(QueryNode input, PropertyExpression[] properties) : base(input) { _properties = properties; }
public static SingleOrDefaultExpression SingleOrDefault(this QueryNode input, ResourceType resourceType) { return(new SingleOrDefaultExpression(input, resourceType)); }
public QueryOptionExpression(QueryNode input, string name, object value) : base(input) { _optionName = name; _value = value; }
public static CountExpression Count(this QueryNode input, bool isInline) { return(Count(input, "allpages", isInline)); }
//Constructor public SkipExpression(QueryNode input, int predicate, QueryNode scannode) : base(input) { _predicate = predicate; _scannode = scannode; }
public static CountExpression Count(this QueryNode input, string countOption) { bool isInline = countOption.Contains("inline"); return(Count(input, countOption, isInline)); }
public ThenByExpression(QueryNode input, PropertyExpression[] properties, QueryNode scannode, bool bAscDesc) : this(input, properties, scannode, bAscDesc, false) { }
//Constructor public ProjectExpression(QueryNode input, params ExpNode[] projections) : base(input) { _projections = new Nodes <ExpNode>(this, projections); }
//Constructor public FirstOrDefaultExpression(QueryNode input, ResourceType resourceType) : base(input) { _resourceType = resourceType; }
//Constructor public PredicateExpression(QueryNode input, ExpNode predicate) : base(input) { _predicate = predicate; _type = input.Type; }
private static bool compareKeyURI(string uriFound, KeyExpression keyExpected) { UriQueryBuilder builder = new UriQueryBuilder(keyExpected.ResourceContainer.Workspace, keyExpected.ResourceContainer.Workspace.ServiceUri); builder.EscapeUriValues = true; builder.CleanUpSpecialCharacters = false; builder.UseBinaryFormatForDates = false; switch (keyExpected.IncludeInUri.Count(i => i)) { case 0: AstoriaTestLog.FailAndThrow("Cannot compare KeyExpression to URI, key has no included values"); return(false); case 1: // TODO: stop ignoring case QueryNode query = ContainmentUtil.BuildCanonicalQuery(keyExpected); string expected = builder.Build(query); expected = expected.Replace(".0f", "f"); //this is kinda a hack, but TypeData.FormatForKey is going to add the .0, so we need to remove it expected = expected.Replace(".0D", "D"); //this is kinda a hack, but TypeData.FormatForKey is going to add the .0, so we need to remove it bool match = uriFound.Equals(expected, StringComparison.InvariantCultureIgnoreCase); if (!match) { AstoriaTestLog.WriteLineIgnore("Link did not match key, expected '" + expected + "'"); } return(match); default: QueryNode setQuery = ContainmentUtil.BuildCanonicalQuery(keyExpected, true); Workspace w = keyExpected.ResourceContainer.Workspace; string setUri = builder.Build(setQuery); string keySegment = uriFound.Substring(setUri.Length); string expectedKeySegment = "(" + UriQueryBuilder.CreateKeyString(keyExpected, false) + ")"; if (keySegment.Equals(expectedKeySegment, StringComparison.InvariantCultureIgnoreCase)) { return(true); } // if not explicitely equal, need to make sure its not due to a re-ordering of the properties // List <KeyValuePair <string, int> > predicateLocations = new List <KeyValuePair <string, int> >(); for (int i = 0; i < keyExpected.Values.Length; i++) { string predicate = builder.CreateKeyStringPair(keyExpected.Properties[i].Name, keyExpected.Values[i].ClrValue); int offset = keySegment.IndexOf(predicate); if (offset < 0) { return(false); } predicateLocations.Add(new KeyValuePair <string, int>(predicate, offset)); } predicateLocations.Sort(delegate(KeyValuePair <string, int> pair1, KeyValuePair <string, int> pair2) { return(pair1.Value.CompareTo(pair2.Value)); }); expectedKeySegment = "(" + String.Join(",", predicateLocations.Select(pair => pair.Key).ToArray()) + ")"; return(keySegment.Equals(expectedKeySegment, StringComparison.InvariantCultureIgnoreCase)); } }
public static ThenByExpression ThenBy(this QueryNode input, PropertyExpression[] properties, bool bAscDesc) { return(ThenBy(input, properties, bAscDesc, false)); }