Ejemplo n.º 1
0
 public NavigationExpression(QueryNode input, PropertyExpression property, bool isLink)
     : base(input)
 {
     _isLink   = isLink;
     _property = property;
 }
Ejemplo n.º 2
0
 //DML
 public static ProjectExpression Select(this QueryNode input, params ExpNode[] projection)
 {
     return(new ProjectExpression(input, projection));
 }
Ejemplo n.º 3
0
 public NavigationExpression(QueryNode input, PropertyExpression property)
     : this(input, property, false)
 {
 }
Ejemplo n.º 4
0
 public static OrderByExpression Sort(this QueryNode input, ExpNode[] properties, bool bAscDesc)
 {
     return(Sort(input, properties, bAscDesc, false));
 }
Ejemplo n.º 5
0
 //Constructor
 public SingleExpression(QueryNode input, ResourceType resourceType)
     : base(input)
 {
     _resourceType = resourceType;
 }
Ejemplo n.º 6
0
 //Constructor
 public CountExpression(QueryNode input, string countKind, QueryNode scannode)
     : base(input)
 {
     _countKind = countKind;
     _scannode  = scannode;
 }
Ejemplo n.º 7
0
 public OrderByExpression(QueryNode input, ExpNode[] properties, QueryNode scannode, bool bAscDesc)
     : this(input, properties, scannode, bAscDesc, false)
 {
 }
Ejemplo n.º 8
0
 public static PredicateExpression Where(this QueryNode input, ExpNode predicate)
 {
     return(new PredicateExpression(input, predicate));
 }
Ejemplo n.º 9
0
 public static FirstOrDefaultExpression FirstOrDefault(this QueryNode input, ResourceType resourceType)
 {
     return(new FirstOrDefaultExpression(input, resourceType));
 }
Ejemplo n.º 10
0
 public static QueryNode ExpandIfApplicable(this QueryNode input, PropertyExpression[] properties, bool applicable)
 {
     return(applicable ? Expand(input, properties) : input);
 }
Ejemplo n.º 11
0
 public static OfTypeExpression OfType(this QueryNode input, ResourceType resourceType)
 {
     return(new OfTypeExpression(input, resourceType));
 }
Ejemplo n.º 12
0
 public static QueryOptionExpression QueryOption(this QueryNode input, string optionName, string value)
 {
     return(new QueryOptionExpression(input, optionName, value));
 }
Ejemplo n.º 13
0
 public static NavigationExpression Nav(this QueryNode input, PropertyExpression property, bool isLink)
 {
     return(new NavigationExpression(input, property, isLink));
 }
Ejemplo n.º 14
0
 public static NewExpression New(this QueryNode input, params ExpNode[] members)
 {
     return(new NewExpression(input, members));
 }
Ejemplo n.º 15
0
 public ExpandExpression(QueryNode input, PropertyExpression[] properties)
     : base(input)
 {
     _properties = properties;
 }
Ejemplo n.º 16
0
 public static SingleOrDefaultExpression SingleOrDefault(this QueryNode input, ResourceType resourceType)
 {
     return(new SingleOrDefaultExpression(input, resourceType));
 }
Ejemplo n.º 17
0
 public QueryOptionExpression(QueryNode input, string name, object value)
     : base(input)
 {
     _optionName = name;
     _value      = value;
 }
Ejemplo n.º 18
0
 public static CountExpression Count(this QueryNode input, bool isInline)
 {
     return(Count(input, "allpages", isInline));
 }
Ejemplo n.º 19
0
 //Constructor
 public SkipExpression(QueryNode input, int predicate, QueryNode scannode)
     : base(input)
 {
     _predicate = predicate;
     _scannode  = scannode;
 }
Ejemplo n.º 20
0
        public static CountExpression Count(this QueryNode input, string countOption)
        {
            bool isInline = countOption.Contains("inline");

            return(Count(input, countOption, isInline));
        }
Ejemplo n.º 21
0
 public ThenByExpression(QueryNode input, PropertyExpression[] properties, QueryNode scannode, bool bAscDesc)
     : this(input, properties, scannode, bAscDesc, false)
 {
 }
Ejemplo n.º 22
0
 //Constructor
 public ProjectExpression(QueryNode input, params ExpNode[] projections)
     : base(input)
 {
     _projections = new Nodes <ExpNode>(this, projections);
 }
Ejemplo n.º 23
0
 //Constructor
 public FirstOrDefaultExpression(QueryNode input, ResourceType resourceType)
     : base(input)
 {
     _resourceType = resourceType;
 }
Ejemplo n.º 24
0
 //Constructor
 public PredicateExpression(QueryNode input, ExpNode predicate)
     : base(input)
 {
     _predicate = predicate;
     _type      = input.Type;
 }
Ejemplo n.º 25
0
        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));
            }
        }
Ejemplo n.º 26
0
 public static ThenByExpression ThenBy(this QueryNode input, PropertyExpression[] properties, bool bAscDesc)
 {
     return(ThenBy(input, properties, bAscDesc, false));
 }