Franz.Common.MongoDB
1.2.62
dotnet add package Franz.Common.MongoDB --version 1.2.62
NuGet\Install-Package Franz.Common.MongoDB -Version 1.2.62
<PackageReference Include="Franz.Common.MongoDB" Version="1.2.62" />
paket add Franz.Common.MongoDB --version 1.2.62
#r "nuget: Franz.Common.MongoDB, 1.2.62"
// Install Franz.Common.MongoDB as a Cake Addin #addin nuget:?package=Franz.Common.MongoDB&version=1.2.62 // Install Franz.Common.MongoDB as a Cake Tool #tool nuget:?package=Franz.Common.MongoDB&version=1.2.62
Franz.Common.MongoDB
A library within the Franz Framework designed to streamline the integration of MongoDB into .NET applications. This package provides utilities for configuring MongoDB services and registering them with dependency injection.
Features
- MongoDB Service Registration:
MongoServiceRegistration
simplifies the configuration and registration of MongoDB clients and databases.
- Custom Configuration:
- Easily integrate custom configurations for MongoDB connections.
- Dependency Injection Support:
- Provides out-of-the-box DI integration for MongoDB services.
Version Information
- Current Version: 1.2.62
- Part of the private Franz Framework ecosystem.
Dependencies
This package has no additional dependencies beyond the .NET runtime and MongoDB client libraries.
Installation
From Private Azure Feed
Since this package is hosted privately, configure your NuGet client:
dotnet nuget add source "https://your-private-feed-url" \
--name "AzurePrivateFeed" \
--username "YourAzureUsername" \
--password "YourAzurePassword" \
--store-password-in-clear-text
Install the package:
dotnet add package Franz.Common.MongoDB --version 1.2.62
Usage
1. Register MongoDB Services
Use MongoServiceRegistration
to add MongoDB services to your dependency injection container:
using Franz.Common.MongoDB;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMongoDB(options =>
{
options.ConnectionString = "mongodb://localhost:27017";
options.DatabaseName = "MyDatabase";
});
}
}
2. Access MongoDB Services
Inject the MongoDB client or database into your services:
public class MyService
{
private readonly IMongoDatabase _database;
public MyService(IMongoDatabase database)
{
_database = database;
}
public async Task InsertDocumentAsync<T>(T document, string collectionName)
{
var collection = _database.GetCollection<T>(collectionName);
await collection.InsertOneAsync(document);
}
}
3. Customize Configurations
Store custom MongoDB configurations in the config
folder and extend the registration process as needed.
Integration with Franz Framework
The Franz.Common.MongoDB package integrates seamlessly with the Franz Framework, enabling MongoDB-based storage and operations in distributed systems. Combine it with other Franz libraries for enhanced functionality.
Contributing
This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:
- Clone the repository.
- Create a feature branch.
- Submit a pull request for review.
License
This library is licensed under the MIT License. See the LICENSE
file for more details.
Changelog
Version 1.2.62
- Added
MongoServiceRegistration
for streamlined MongoDB service configuration and registration. - Introduced support for custom MongoDB configurations.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- Franz.Common.DependencyInjection (>= 1.2.62)
- Franz.Common.EntityFramework (>= 1.2.62)
- Franz.Common.Http.MultiTenancy (>= 1.2.62)
- MongoDB.Driver (>= 2.22.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.62 | 58 | 1/8/2025 |