Ejemplo n.º 1
0
        /// <summary>
        /// Gets the resulting type of a query.
        /// </summary>
        /// <param name="querySchema">A description of a query.</param>
        /// <returns>The input type for the given query as determined by the source.</returns>
        internal String GetSourceType(QuerySchema querySchema)
        {
            // Search through the sibling queries until the source is found and return the resulting type of that query.
            foreach (QuerySchema innerQuerySchema in this.querySchemaList)
            {
                if (innerQuerySchema.Name == querySchema.Source)
                {
                    return(innerQuerySchema.ResultType);
                }
            }

            // An attempt was made to use and implicit source type from a sibling query that doesn't exist.
            throw new Exception(String.Format("The source is not defined for Query {0}", querySchema.Name));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the previous source in the list of QuerySchema items.
        /// </summary>
        /// <param name="querySchema">A description of a query.</param>
        /// <returns>The name of the previous source in the list of queries associated with ths property.</returns>
        internal String GetPreviousSource(QuerySchema querySchema)
        {
            // When an item is found that matches the given query item, return the name of the previous query item.  This is used
            // to chain together query items with the implicit source coming from the previous item in the list.
            for (int queryIndex = 1; queryIndex < this.querySchemaList.Count; queryIndex++)
            {
                QuerySchema innerQuerySchema = this.querySchemaList[queryIndex];
                if (innerQuerySchema == querySchema)
                {
                    return(this.querySchemaList[queryIndex - 1].Name);
                }
            }

            // An attempt was made to use a query item without an explicit source or an implicit previous source.
            throw new Exception(String.Format("The source is not defined for Query {0}", querySchema.Name));
        }