Update README.md
This commit is contained in:
committed by
GitHub
parent
657beeac99
commit
e91c89f054
@@ -46,6 +46,14 @@ The repository can be instantiated like so:
|
|||||||
ITestRepository testRepository = new TestRepository(connectionString, "MongoDbTests");
|
ITestRepository testRepository = new TestRepository(connectionString, "MongoDbTests");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you prefer to reuse the same MongoDb database across you application, you can use the `MongoDatabase` from the MongoDb driver implementing the `IMongoDatabase` interface:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var client = new MongoClient(connectionString);
|
||||||
|
var mongoDbDatabase = Client.GetDatabase(databaseName);
|
||||||
|
ITestRepository testRepository = new TestRepository(mongoDbDatabase);
|
||||||
|
```
|
||||||
|
|
||||||
## Adding documents
|
## Adding documents
|
||||||
To add a document, its class must inherit from the `Document` class, implement the `IDocument` or `IDocument<TKey>` interface:
|
To add a document, its class must inherit from the `Document` class, implement the `IDocument` or `IDocument<TKey>` interface:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user