| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
|
| 3 |
#pragma warning disable 1591 |
| 4 |
|
| 5 |
namespace System.Reactive.Linq |
| 6 |
{ |
| 7 |
public static partial class Qbservable |
| 8 |
{ |
| 9 |
private static IQbservableProvider s_provider; |
| 10 |
|
| 11 |
/// <summary> |
| 12 |
/// Gets the local query provider which will retarget Qbservable-based queries to the corresponding Observable-based query for in-memory execution upon subscription. |
| 13 |
/// </summary> |
| 14 |
public static IQbservableProvider Provider |
| 15 |
{ |
| 16 |
get |
| 17 |
{ |
| 18 |
if (s_provider == null) |
| 19 |
s_provider = new ObservableQueryProvider(); |
| 20 |
|
| 21 |
return s_provider; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
/// <summary> |
| 26 |
/// Converts an in-memory observable sequence into an IQbservable<T> sequence with an expression tree representing the source sequence. |
| 27 |
/// </summary> |
| 28 |
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam> |
| 29 |
/// <param name="source">Source sequence.</param> |
| 30 |
/// <returns>IQbservable<T> sequence representing the given observable source sequence.</returns> |
| 31 |
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception> |
| 32 |
public static IQbservable<TSource> AsQbservable<TSource>(this IObservable<TSource> source) |
| 33 |
{ |
| 34 |
if (source == null) |
| 35 |
throw new ArgumentNullException("source"); |
| 36 |
|
| 37 |
return new ObservableQuery<TSource>(source); |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
#pragma warning restore 1591 |