MongoDatabaseBase.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* Copyright 2010-2016 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;
  16. using System.Threading;
  17. using System.Threading.Tasks;
  18. using MongoDB.Bson;
  19. namespace MongoDB.Driver
  20. {
  21. /// <summary>
  22. /// Base class for implementors of <see cref="IMongoDatabase" />.
  23. /// </summary>
  24. public abstract class MongoDatabaseBase : IMongoDatabase
  25. {
  26. // public properties
  27. /// <inheritdoc />
  28. public abstract IMongoClient Client { get; }
  29. /// <inheritdoc />
  30. public abstract DatabaseNamespace DatabaseNamespace { get; }
  31. /// <inheritdoc />
  32. public abstract MongoDatabaseSettings Settings { get; }
  33. // public methods
  34. /// <inheritdoc />
  35. public virtual void CreateCollection(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  36. {
  37. throw new NotImplementedException();
  38. }
  39. /// <inheritdoc />
  40. public abstract Task CreateCollectionAsync(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken));
  41. /// <inheritdoc />
  42. public virtual void CreateView<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
  43. {
  44. throw new NotImplementedException();
  45. }
  46. /// <inheritdoc />
  47. public virtual Task CreateViewAsync<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
  48. {
  49. throw new NotImplementedException();
  50. }
  51. /// <inheritdoc />
  52. public virtual void DropCollection(string name, CancellationToken cancellationToken = default(CancellationToken))
  53. {
  54. throw new NotImplementedException();
  55. }
  56. /// <inheritdoc />
  57. public abstract Task DropCollectionAsync(string name, CancellationToken cancellationToken = default(CancellationToken));
  58. /// <inheritdoc />
  59. public abstract IMongoCollection<TDocument> GetCollection<TDocument>(string name, MongoCollectionSettings settings = null);
  60. /// <inheritdoc />
  61. public virtual IAsyncCursor<BsonDocument> ListCollections(ListCollectionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  62. {
  63. throw new NotImplementedException();
  64. }
  65. /// <inheritdoc />
  66. public abstract Task<IAsyncCursor<BsonDocument>> ListCollectionsAsync(ListCollectionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken));
  67. /// <inheritdoc />
  68. public virtual void RenameCollection(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  69. {
  70. throw new NotImplementedException();
  71. }
  72. /// <inheritdoc />
  73. public abstract Task RenameCollectionAsync(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken));
  74. /// <inheritdoc />
  75. public virtual TResult RunCommand<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default(CancellationToken))
  76. {
  77. throw new NotImplementedException();
  78. }
  79. /// <inheritdoc />
  80. public abstract Task<TResult> RunCommandAsync<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default(CancellationToken));
  81. /// <inheritdoc />
  82. public virtual IMongoDatabase WithReadConcern(ReadConcern readConcern)
  83. {
  84. throw new NotImplementedException();
  85. }
  86. /// <inheritdoc />
  87. public virtual IMongoDatabase WithReadPreference(ReadPreference readPreference)
  88. {
  89. throw new NotImplementedException();
  90. }
  91. /// <inheritdoc />
  92. public virtual IMongoDatabase WithWriteConcern(WriteConcern writeConcern)
  93. {
  94. throw new NotImplementedException();
  95. }
  96. }
  97. }