1
0

QueryServices.cs 979 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Reactive.PlatformServices;
  6. namespace System.Reactive.Linq
  7. {
  8. internal static class QueryServices
  9. {
  10. private static IQueryServices s_services = Initialize();
  11. public static T GetQueryImpl<T>(T defaultInstance)
  12. {
  13. return s_services.Extend(defaultInstance);
  14. }
  15. private static IQueryServices Initialize()
  16. {
  17. return PlatformEnlightenmentProvider.Current.GetService<IQueryServices>() ?? new DefaultQueryServices();
  18. }
  19. }
  20. internal interface IQueryServices
  21. {
  22. T Extend<T>(T baseImpl);
  23. }
  24. class DefaultQueryServices : IQueryServices
  25. {
  26. public T Extend<T>(T baseImpl)
  27. {
  28. return baseImpl;
  29. }
  30. }
  31. }