| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
|
| 3 |
using System; |
| 4 |
using System.Reactive.PlatformServices; |
| 5 |
|
| 6 |
namespace System.Reactive.Linq |
| 7 |
{ |
| 8 |
internal static class QueryServices |
| 9 |
{ |
| 10 |
private static Lazy<IQueryServices> s_services = new Lazy<IQueryServices>(Initialize); |
| 11 |
|
| 12 |
public static T GetQueryImpl<T>(T defaultInstance) |
| 13 |
{ |
| 14 |
return s_services.Value.Extend(defaultInstance); |
| 15 |
} |
| 16 |
|
| 17 |
private static IQueryServices Initialize() |
| 18 |
{ |
| 19 |
return PlatformEnlightenmentProvider.Current.GetService<IQueryServices>() ?? new DefaultQueryServices(); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
internal interface IQueryServices |
| 24 |
{ |
| 25 |
T Extend<T>(T baseImpl); |
| 26 |
} |
| 27 |
|
| 28 |
class DefaultQueryServices : IQueryServices |
| 29 |
{ |
| 30 |
public T Extend<T>(T baseImpl) |
| 31 |
{ |
| 32 |
return baseImpl; |
| 33 |
} |
| 34 |
} |
| 35 |
} |