internal RequestDescription(RequestDescription other, Expression resultExpression, System.Data.Services.Providers.RootProjectionNode rootProjectionNode) { this.containerName = other.containerName; this.mimeType = other.mimeType; this.resultUri = other.resultUri; this.segmentInfos = other.SegmentInfos; this.rootProjectionNode = rootProjectionNode; this.countOption = other.countOption; this.SkipTokenExpressionCount = other.SkipTokenExpressionCount; this.SkipTokenProperties = other.SkipTokenProperties; this.countValue = other.countValue; this.responseVersion = other.ResponseVersion; this.actualResponseVersion = other.ActualResponseVersion; this.PreferenceApplied = other.PreferenceApplied; if (resultExpression == null) { this.segmentInfos = other.SegmentInfos; } else { int index = other.SegmentInfos.Length - 1; SegmentInfo info = other.SegmentInfos[index]; info.RequestExpression = resultExpression; } }
/// <summary>Initializes a new RequestDescription based on an existing one.</summary> /// <param name="other">Other description to base new description on.</param> /// <param name="queryResults">Query results for new request description.</param> /// <param name="rootProjectionNode">Projection segment describing the projections on the top level of the query.</param> internal RequestDescription( RequestDescription other, IEnumerable queryResults, RootProjectionNode rootProjectionNode) { Debug.Assert( queryResults == null || other.SegmentInfos != null, "queryResults == null || other.SegmentInfos != null -- otherwise there isn't a segment in which to replace the query."); Debug.Assert( rootProjectionNode == null || queryResults != null, "rootProjectionNode == null || queryResults != null -- otherwise there isn't a query to execute and expand"); this.containerName = other.containerName; this.mimeType = other.mimeType; this.usesContainerName = other.usesContainerName; this.resultUri = other.resultUri; this.segmentInfos = other.SegmentInfos; this.rootProjectionNode = rootProjectionNode; this.countOption = other.countOption; this.SkipTokenExpressionCount = other.SkipTokenExpressionCount; this.SkipTokenProperties = other.SkipTokenProperties; this.countValue = other.countValue; this.requireMinimumVersion = other.requireMinimumVersion; this.responseVersion = other.responseVersion; this.maxFeatureVersion = other.maxFeatureVersion; if (queryResults == null) { this.segmentInfos = other.SegmentInfos; } else { int lastSegmentIndex = other.SegmentInfos.Length - 1; SegmentInfo lastSegmentInfo = other.SegmentInfos[lastSegmentIndex]; lastSegmentInfo.RequestEnumerable = queryResults; } }