Beispiel #1
0
 /// <summary>
 /// Converts the given OfType segment into a string
 /// </summary>
 /// <param name="segment">The segment to convert</param>
 /// <returns>The converted segment string</returns>
 public string ConvertToString(EntityTypeSegment segment)
 {
     return(this.EscapeUriString(segment.EntityType.FullName));
 }
Beispiel #2
0
        private QueryExpression AddEntityTypeFilter(EntitySet currentEntitySet, QueryExpression query, EntityTypeSegment oftypeSegment)
        {
            ExceptionUtilities.CheckObjectNotNull(currentEntitySet, "Expected an EntitySet Segment prior to a an EntityTypeSegment");

            var queryEntityType = this.Repository.TypeLibrary.GetQueryEntityType(currentEntitySet, oftypeSegment.EntityType);

            ExceptionUtilities.CheckObjectNotNull(queryEntityType, "QueryEntityType must not be null");

            // have to resolve the query to determine if its a singleton or a collection so far
            query = this.QueryResolver.Resolve(query);
            if (query.ExpressionType is QueryCollectionType)
            {
                query = query.OfType(queryEntityType);
            }
            else
            {
                query = query.As(queryEntityType);
            }

            return(query);
        }