/// <summary>
        /// Takes an enumerable and builds a host for remote processing.
        /// </summary>
        /// <typeparam name="T">The type of the query.</typeparam>
        /// <param name="source">The source to parse.</param>
        /// <param name="context">The context of the query.</param>
        /// <returns>The <see cref="RemoteQuery{T, TProvider}"/>.</returns>
        public static IQueryable <T> AsRemoteQueryable <T>(this IEnumerable <T> source, RemoteContext context)
        {
            var query    = source.AsQueryable();
            var provider = new RemoteQueryProvider <T>(source.AsQueryable(), context);

            return(new RemoteQuery <T, RemoteQueryProvider <T> >(query.Expression, provider));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an instance of <see cref="IRemoteQueryable{T}" /> that utilizes the data provider specified.
        /// </summary>
        /// <typeparam name="T">Element type of the <see cref="IRemoteQueryable{T}"/>.</typeparam>
        /// <typeparam name="TSource">Data type served by the data provider.</typeparam>
        public static IRemoteQueryable <T> CreateQueryable <T, TSource>(
            this RemoteQueryableFactory factory,
            Func <RemoteLinq.Expression, TSource?> dataProvider,
            IQueryResultMapper <TSource> resultMapper,
            IExpressionToRemoteLinqContext?context = null)
        {
            var queryProvider = new RemoteQueryProvider <TSource>(dataProvider, resultMapper, context);

            return(new RemoteQueryable <T>(queryProvider));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates an instance of <see cref="IRemoteQueryable" /> that utilizes the data provider specified.
        /// </summary>
        /// <typeparam name="TSource">Data type served by the data provider.</typeparam>
        public static IRemoteQueryable CreateQueryable <TSource>(
            this RemoteQueryableFactory factory,
            Type elementType,
            Func <RemoteLinq.Expression, TSource?> dataProvider,
            IQueryResultMapper <TSource> resultMapper,
            IExpressionToRemoteLinqContext?context = null)
        {
            var queryProvider = new RemoteQueryProvider <TSource>(dataProvider, resultMapper, context);

            return(new Remote.Linq.DynamicQuery.RemoteQueryable(elementType, queryProvider));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates an instance of <see cref="IQueryable{T}" /> that utilizes the data provider specified.
        /// </summary>
        /// <typeparam name="T">Element type of the <see cref="IQueryable{T}"/>.</typeparam>
        /// <typeparam name="TSource">Data type served by the data provider.</typeparam>
        public static IQueryable <T> CreateQueryable <T, TSource>(this RemoteQueryableFactory factory, Func <Expressions.Expression, TSource> dataProvider, IQueryResultMapper <TSource> resultMapper, ITypeInfoProvider typeInfoProvider = null, Func <System.Linq.Expressions.Expression, bool> canBeEvaluatedLocally = null)
        {
            var queryProvider = new RemoteQueryProvider <TSource>(dataProvider, typeInfoProvider, resultMapper, canBeEvaluatedLocally);

            return(new Remote.Linq.DynamicQuery.RemoteQueryable <T>(queryProvider));
        }