Beispiel #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)
                               )
                           )
                       ));
        }
Beispiel #2
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> >))
                           )
                       ));
        }