Пример #1
0
 /// <summary>Internal constructor.</summary>
 /// <param name="queryProvider">The query provider to use for this query.</param>
 /// <param name="queryExpression">The query expression for this query (the DSP version).</param>
 internal DSPLinqQuery(DSPLinqQueryProvider queryProvider, Expression queryExpression)
 {
     this.queryProvider   = queryProvider;
     this.queryExpression = queryExpression;
 }
        /// <summary>Wraps a query in a new query which will translate the DSP query into a LINQ to Objects runnable query
        /// and run it on the provided <paramref name="underlyingQuery"/>.</summary>
        /// <param name="underlyingQuery">The underlying (LINQ to Objects) query to wrap.</param>
        /// <returns>A new query which can handle the DSP expressions and run them on top of the <pararef name="underlyingQuery"/>.</returns>
        public static IQueryable CreateQuery(IQueryable underlyingQuery)
        {
            DSPLinqQueryProvider provider = new DSPLinqQueryProvider(underlyingQuery.Provider);

            return(provider.CreateQuery(underlyingQuery.Expression));
        }
 /// <summary>Returns a query which can be used to retrive resource from the specified resource set.</summary>
 /// <param name="resourceSet">The resource set to get the quqeyr for.</param>
 /// <returns>An <see cref="IQueryable"/> which will be used to get resources from the specified resource set.</returns>
 /// <remarks>The data service will use the LINQ to build the actual query required for the resource set. It's up to this provider
 /// to return an <see cref="IQueryable"/> which can handle such queries. If the resource set is not recognized by the provider it should return null.</remarks>
 public System.Linq.IQueryable GetQueryRootForResourceSet(ResourceSet resourceSet)
 {
     return(DSPLinqQueryProvider.CreateQuery(this.dataSource.GetResourceSetEntities(resourceSet.Name).AsQueryable()));
 }