/// <summary>
        /// Initializes a new instance of the <see cref="FetchQueryModelBuilder"/> class.
        /// </summary>
        /// <param name="fetchRequest">The fetch request.</param>
        /// <param name="queryModel">The query model for which the <paramref name="fetchRequest"/> was originally defined.</param>
        /// <param name="resultOperatorPosition">The result operator position where the <paramref name="fetchRequest"/> was originally located.
        /// The <see cref="FetchQueryModelBuilder"/> will include all result operators prior to this position into the fetch <see cref="SourceItemQueryModel"/>,
        /// but it will not include any result operators occurring after (or at) that position.</param>
        public FetchQueryModelBuilder(FetchRequestBase fetchRequest, QueryModel queryModel, int resultOperatorPosition)
        {
            ArgumentUtility.CheckNotNull("fetchRequest", fetchRequest);
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            FetchRequest           = fetchRequest;
            SourceItemQueryModel   = queryModel;
            ResultOperatorPosition = resultOperatorPosition;
        }
        /// <summary>
        /// Gets or adds an eager-fetch request to this <see cref="FetchRequestCollection"/>.
        /// </summary>
        /// <param name="fetchRequest">The <see cref="FetchRequestBase"/> to be added.</param>
        /// <returns>
        /// <paramref name="fetchRequest"/> or, if another <see cref="FetchRequestBase"/> for the same relation member already existed,
        /// the existing <see cref="FetchRequestBase"/>.
        /// </returns>
        public FetchRequestBase GetOrAddFetchRequest(FetchRequestBase fetchRequest)
        {
            ArgumentUtility.CheckNotNull("fetchRequest", fetchRequest);

            FetchRequestBase existingFetchRequest;

            if (_fetchRequests.TryGetValue(fetchRequest.RelationMember, out existingFetchRequest))
            {
                return(existingFetchRequest);
            }
            else
            {
                _fetchRequests.Add(fetchRequest.RelationMember, fetchRequest);
                return(fetchRequest);
            }
        }
 /// <summary>
 /// Gets or adds an inner eager-fetch request for this <see cref="FetchRequestBase"/>.
 /// </summary>
 /// <param name="fetchRequest">The <see cref="FetchRequestBase"/> to be added.</param>
 /// <returns>
 /// <paramref name="fetchRequest"/> or, if another <see cref="FetchRequestBase"/> for the same relation member already existed,
 /// the existing <see cref="FetchRequestBase"/>.
 /// </returns>
 public FetchRequestBase GetOrAddInnerFetchRequest(FetchRequestBase fetchRequest)
 {
     ArgumentUtility.CheckNotNull("fetchRequest", fetchRequest);
     return(_innerFetchRequestCollection.GetOrAddFetchRequest(fetchRequest));
 }