Ejemplo n.º 1
0
        /// <summary>
        /// Joins together the results from several patterns.
        /// </summary>
        /// <typeparam name="TResult">The type of the elements in the result sequence, obtained from the specified patterns.</typeparam>
        /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
        /// <param name="plans">A series of plans created by use of the Then operator on patterns.</param>
        /// <returns>An observable sequence with the results from matching several patterns.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="provider"/> or <paramref name="plans"/> is null.</exception>
        public static IQbservable <TResult> When <TResult>(this IQbservableProvider provider, params QueryablePlan <TResult>[] plans)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (plans == null)
            {
                throw new ArgumentNullException(nameof(plans));
            }

            return(provider.CreateQuery <TResult>(
                       Expression.Call(
                           null,
#if CRIPPLED_REFLECTION
                           InfoOf(() => Qbservable.When <TResult>(default(IQbservableProvider), default(QueryablePlan <TResult>[]))),
#else
                           ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
#endif
                           Expression.Constant(provider, typeof(IQbservableProvider)),
                           Expression.NewArrayInit(
                               typeof(QueryablePlan <TResult>),
                               plans.Select(p => p.Expression)
                               )
                           )
                       ));
        }
Ejemplo n.º 2
0
        public static IQbservable <TResult> Create <TResult>(this IQbservableProvider provider, Expression <Func <IObserver <TResult>, IEnumerable <IObservable <object> > > > iteratorMethod)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (iteratorMethod == null)
            {
                throw new ArgumentNullException(nameof(iteratorMethod));
            }

            return(provider.CreateQuery <TResult>(
                       Expression.Call(
                           null,
#if CRIPPLED_REFLECTION
                           InfoOf(() => QbservableEx.Create <TResult>(default(IQbservableProvider), default(Expression <Func <IObserver <TResult>, IEnumerable <IObservable <object> > > >))),
#else
                           ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
#endif
                           Expression.Constant(provider, typeof(IQbservableProvider)),
                           iteratorMethod
                           )
                       ));
        }
Ejemplo n.º 3
0
        public static IQbservable <TSource[]> ForkJoin <TSource>(this IQbservableProvider provider, IEnumerable <IObservable <TSource> > sources)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (sources == null)
            {
                throw new ArgumentNullException(nameof(sources));
            }

            return(provider.CreateQuery <TSource[]>(
                       Expression.Call(
                           null,
#if CRIPPLED_REFLECTION
                           InfoOf(() => QbservableEx.ForkJoin <TSource>(default(IQbservableProvider), default(IEnumerable <IObservable <TSource> >))),
#else
                           ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
#endif
                           Expression.Constant(provider, typeof(IQbservableProvider)),
                           GetSourceExpression(sources)
                           )
                       ));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Joins together the results from several patterns.
        /// </summary>
        /// <typeparam name="TResult">The type of the elements in the result sequence, obtained from the specified patterns.</typeparam>
        /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
        /// <param name="plans">A series of plans created by use of the Then operator on patterns.</param>
        /// <returns>An observable sequence with the results form matching several patterns.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="provider"/> or <paramref name="plans"/> is null.</exception>
        public static IQbservable <TResult> When <TResult>(this IQbservableProvider provider, IEnumerable <QueryablePlan <TResult> > plans)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }
            if (plans == null)
            {
                throw new ArgumentNullException("plans");
            }

            return(provider.CreateQuery <TResult>(
                       Expression.Call(
                           null,
#if CRIPPLED_REFLECTION
                           InfoOf(() => Qbservable.When <TResult>(default(IQbservableProvider), default(IEnumerable <QueryablePlan <TResult> >))),
#else
                           ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
#endif
                           Expression.Constant(provider, typeof(IQbservableProvider)),
                           Expression.Constant(plans, typeof(IEnumerable <QueryablePlan <TResult> >))
                           )
                       ));
        }