IMongoQueryProvider.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright 2015-present MongoDB 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.Linq;
  16. using System.Linq.Expressions;
  17. using System.Threading;
  18. using System.Threading.Tasks;
  19. using MongoDB.Bson.Serialization;
  20. namespace MongoDB.Driver.Linq
  21. {
  22. /// <summary>
  23. /// An implementation of <see cref="IQueryProvider" /> for MongoDB.
  24. /// </summary>
  25. internal interface IMongoQueryProvider : IQueryProvider
  26. {
  27. /// <summary>
  28. /// Gets the collection namespace.
  29. /// </summary>
  30. CollectionNamespace CollectionNamespace { get; }
  31. /// <summary>
  32. /// Gets the collection document serializer.
  33. /// </summary>
  34. IBsonSerializer CollectionDocumentSerializer { get; }
  35. /// <summary>
  36. /// Gets the execution model.
  37. /// </summary>
  38. /// <param name="expression">The expression.</param>
  39. /// <returns>The execution model.</returns>
  40. QueryableExecutionModel GetExecutionModel(Expression expression);
  41. /// <summary>
  42. /// Executes the strongly-typed query represented by a specified expression tree.
  43. /// </summary>
  44. /// <typeparam name="TResult">The type of the result.</typeparam>
  45. /// <param name="expression">An expression tree that represents a LINQ query.</param>
  46. /// <param name="cancellationToken">The cancellation token.</param>
  47. /// <returns>The value that results from executing the specified query.</returns>
  48. Task<TResult> ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken = default(CancellationToken));
  49. }
  50. }