Esempio n. 1
0
        /// <summary>
        /// Expands the graph expression along the specified property, but returns only the terminal type
        /// The new graph expression will bind a given context if and only if both the old expression and the addition bind
        /// </summary>
        /// <typeparam name="Y">type of query</typeparam>
        /// <param name="property">property along which to expand</param>
        /// <param name="filterGenerator">a filter generator to restrict results</param>
        /// <returns>a TypedQueryableGraph</returns>
        public ITypedQueryableGraph Select <Y>(Resource property, IFilterGenerator <Y> filterGenerator = null) where Y : Resource
        {
            var expansion = Select <Y>(filterGenerator);
            var query     = Select(property, expansion);

            return(new TypedQueryableGraph(GraphProvider, query.GraphExpression, new LabelledTreeNode <Type, Term>(typeof(Y))));
        }
Esempio n. 2
0
        /// <summary>
        /// Start of a query, returns objects of the specified type
        /// </summary>
        /// <typeparam name="Y">type of query</typeparam>
        /// <param name="filterGenerator">a filter generator to restrict results</param>
        /// <returns>a TypedQueryableGraph</returns>
        public ITypedQueryableGraph Select <Y>(IFilterGenerator <Y> filterGenerator = null) where Y : Resource
        {
            var objectGraph = ConvertTypeToGraph(typeof(Y));
            var filter      = filterGenerator != null?filterGenerator.Generate(objectGraph) : null;

            return(new TypedQueryableGraph(GraphProvider, new GraphExpression(objectGraph, filter), new LabelledTreeNode <Type, Term>(typeof(Y))));
        }
Esempio n. 3
0
        /// <summary>
        /// Expands the graph expression along the specified property.
        /// The new graph expression will bind a given context if and only if both the old expression and the addition bind
        /// </summary>
        /// <typeparam name="Y">type of expansion</typeparam>
        /// <param name="property">property along which to expand</param>
        /// <param name="filterGenerator">a filter generator to restrict results</param>
        /// <returns>a TypedQueryableGraph</returns>
        public ITypedQueryableGraph Require <Y>(Resource property, IFilterGenerator <Y> filterGenerator = null) where Y : Resource
        {
            var expansion = Select <Y>(filterGenerator);
            var typeGraph = TypeGraph.Copy().AddChild(property, expansion.TypeGraph);
            var query     = Require(property, expansion);

            return(new TypedQueryableGraph(GraphProvider, query.GraphExpression, typeGraph));
        }
Esempio n. 4
0
 /// <summary>
 /// Returns a queryable graph
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns>a TypedQueryableGraph</returns>
 public ITypedQueryableGraph Select <T>(IFilterGenerator <T> filterGenerator = null) where T : Resource
 {
     return((new TypedQueryableGraph(GraphProvider)).Select <T>(filterGenerator));
 }