Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 22, 2020. It is now read-only.
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

Using a shared MongoClient or MongoDatabase instance#43

Copy link
Copy link
@ducas

Description

@ducas
Issue body actions

I'm using a MongoDB instance behind self-signed SSL, which means that to use this project I need to include sslVerifyCertificate=false on my connection string... that's bad. 馃槩

Do you think it would be a good idea to be able to initialise a MongoRepository by passing it a MongoClient. e.g.

var settings = new MongoClientSettings{ /*...*/ }
var client = new MongoClient(settings);
var db = client.GetServer().GetDatabase("mydb");
var repository = new MongoRepository(db, "mycollection");

Also it could be good to have a factory or context that provides the repositories -

var context = new MongoContext(db);
var repository = context.Repository<MyType>("mycollection");

This way you could pass an initialised context around and easily create repositories.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.