private void CheckExpandPaths() { if (this.expandPathsAsText.Count > 0) { if (this.queryExpression == null) { throw DataServiceException.CreateBadRequestError(System.Data.Services.Strings.RequestQueryProcessor_QueryExpandOptionNotApplicable); } if (this.description.TargetResourceType.ResourceTypeKind == ResourceTypeKind.Collection) { throw DataServiceException.CreateBadRequestError(System.Data.Services.Strings.RequestQueryProcessor_QueryExpandOptionNotApplicable); } } this.expandPaths = new List <ExpandSegmentCollection>(this.expandPathsAsText.Count); for (int i = this.expandPathsAsText.Count - 1; i >= 0; i--) { ExpandSegmentCollection item = this.CheckSingleExpandPath(this.expandPathsAsText[i]); if (item == null) { this.expandPathsAsText.RemoveAt(i); } else { this.expandPaths.Add(item); ExpandedProjectionNode rootProjectionNode = this.GetRootProjectionNode(); for (int j = 0; j < item.Count; j++) { ExpandSegment segment = item[j]; ExpandedProjectionNode node2 = rootProjectionNode.AddExpandedNode(segment); this.GetRootProjectionNode().ExpansionOnDerivedTypesSpecified |= rootProjectionNode.HasExpandedPropertyOnDerivedType; rootProjectionNode = node2; } this.GetRootProjectionNode().ExpansionsSpecified = true; } } }