Dosaic.Plugins.Persistence.MongoDb
1.0.26
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Dosaic.Plugins.Persistence.MongoDb --version 1.0.26
NuGet\Install-Package Dosaic.Plugins.Persistence.MongoDb -Version 1.0.26
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dosaic.Plugins.Persistence.MongoDb" Version="1.0.26" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dosaic.Plugins.Persistence.MongoDb --version 1.0.26
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dosaic.Plugins.Persistence.MongoDb, 1.0.26"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Dosaic.Plugins.Persistence.MongoDb as a Cake Addin #addin nuget:?package=Dosaic.Plugins.Persistence.MongoDb&version=1.0.26 // Install Dosaic.Plugins.Persistence.MongoDb as a Cake Tool #tool nuget:?package=Dosaic.Plugins.Persistence.MongoDb&version=1.0.26
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Dosaic.Plugins.Persistence.MongoDb
Dosaic.Plugins.Persistence.MongoDb is a plugin
that allows other Dosaic components
to use the MongoDb core to interact with certain databases
.
Installation
To install the nuget package follow these steps:
dotnet add package Dosaic.Plugins.Persistence.MongoDb
or add as package reference to your .csproj
<PackageReference Include="Dosaic.Plugins.Persistence.MongoDb" Version="" />
Appsettings.yml
Configure your appsettings.yml with these properties
Postgres for example
mongodb:
host: "localhost"
database: "mongodb"
port: "27017"
password: "mongodb"
user: "mongodb"
MongoDbConfiguration.cs
[Configuration("mongodb")]
public class MongoDbConfiguration
{
public string Host { get; set; } = null!;
public int Port { get; set; }
public string Database { get; set; } = null!;
public string AuthDatabase { get; set; } = null!;
public string User { get; set; } = null!;
public string Password { get; set; } = null!;
}
Configuration in your plugin host
Nothing to configure
Usage
IRepository<>, IReadRepository<>, IWriteRepository<>
public class ExampleService
{
private readonly IReadRepository<MyPoco> _readRepository;
public ExampleService(IReadRepository<MyPoco> readRepository)
{
_readRepository = readRepository;
}
public async Task DoStuff()
{
// for example
var result = await _readRepository.FindByIdAsync();
}
}
IMongoDbInstance
public class ExampleService
{
private readonly IMongoDbInstance _mongoDbInstance;
public ExampleService(IMongoDbInstance mongoDbInstance)
{
_mongoDbInstance = mongoDbInstance;
}
public async Task DoStuff()
{
// for example
var mongoCollection = _mongoDbInstance.GetCollectionFor<MyCollectionEntity>();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- AspNetCore.HealthChecks.MongoDb (>= 9.0.0)
- Dosaic.Plugins.Persistence.Abstractions (>= 1.0.26)
- MongoDB.Driver (>= 3.1.0)
- MongoDBMigrations (>= 2.2.0)
- Newtonsoft.Json (>= 13.0.3)
- SSH.NET (>= 2024.2.0)
- System.Net.Http (>= 4.3.4)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.