You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.5 KiB

  1. /* Copyright 2010-2011 10gen Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using System.Collections;
  17. using System.Collections.Generic;
  18. using System.Linq;
  19. using System.Linq.Expressions;
  20. using System.Text;
  21. using System.Threading;
  22. namespace MongoDB.Driver.Linq {
  23. /// <summary>
  24. /// Static class that contains the Mongo Linq extension methods.
  25. /// </summary>
  26. public static class MongoLinqExtensionMethods {
  27. /// <summary>
  28. /// Returns an instance of IQueryable{{T}} for a MongoCollection.
  29. /// </summary>
  30. /// <typeparam name="T">The type of the returned documents.</typeparam>
  31. /// <param name="collection">The name of the collection.</param>
  32. /// <returns>An instance of IQueryable{{T}} for a MongoCollection.</returns>
  33. public static IQueryable<T> AsQueryable<T>(
  34. this MongoCollection collection
  35. ) {
  36. var provider = new MongoQueryProvider(collection);
  37. return new MongoQueryable<T>(provider);
  38. }
  39. }
  40. }