protected virtual IEnumerable <string> GetParts() { if (Select.Any()) { yield return("$select=" + String.Join(",", Select)); } if (Expand.Any()) { yield return("$expand=" + String.Join(",", Expand.Select(e => $"{e.PropertyName}({e})"))); } if (Filter.Any()) { yield return("$filter=" + String.Join(" and ", Filter)); } }
/// <summary> /// Create the <see cref="JoinTrie"/> from the paths in all the arguments /// </summary> private JoinTrie PrepareJoin(ArraySegment <string>?pathToCollection = null) { // construct the join tree var allPaths = new List <string[]>(); if (Select != null) { allPaths.AddRange(Select.Select(e => e.Path)); } if (Expand != null) { allPaths.AddRange(Expand.Select(e => e.Path)); } if (Filter != null) { allPaths.AddRange(Filter.ColumnAccesses().Select(e => e.Path)); } if (OrderBy != null) { allPaths.AddRange(OrderBy.ColumnAccesses().Select(e => e.Path)); } if (pathToCollection != null) { var pathToCollectionEntity = new ArraySegment <string>( pathToCollection.Value.Array, pathToCollection.Value.Offset, pathToCollection.Value.Count - 1); allPaths.Add(pathToCollectionEntity.ToArray()); } // This will represent the mapping from paths to symbols return(JoinTrie.Make(ResultDescriptor, allPaths)); }