AWLMongoWrapper 1.0.1

dotnet add package AWLMongoWrapper --version 1.0.1                
NuGet\Install-Package AWLMongoWrapper -Version 1.0.1                
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="AWLMongoWrapper" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AWLMongoWrapper --version 1.0.1                
#r "nuget: AWLMongoWrapper, 1.0.1"                
#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 AWLMongoWrapper as a Cake Addin
#addin nuget:?package=AWLMongoWrapper&version=1.0.1

// Install AWLMongoWrapper as a Cake Tool
#tool nuget:?package=AWLMongoWrapper&version=1.0.1                

MongoWrapper

Basic MongoDB wrapper to allow a reusable instance of a Mongo DB instance with CRUD control.

Installation

There are two required settings that must be made available through app settings. Those settings are as follows:


{
  "MongoWrapper": {
    "ConnectionString": "MongoDB Connection String",
    "DatabaseName": "Target Database Name"
  }
}

Usage

To initialise the connection to the database, the method AddMongoWrapper should be called passing in an IConfiguration instance that contains the above configuration settings.

I.e. .AddMongoWrapper(_configuration);

To then utilise the connection provided, ensure the interface IDatabaseService is injected wherever it needs to be utilised. This can then be referenced to complete basic CRUD operations on the database for a given target collection.

I.e.

  private readonly IDatabaseService _databaseService;

  public MyRepository (IDatabaseService databaseService) {
    _databaseService = databaseService;
  }

  public Task<List<Entity>> MyMethod =>
    _databaseService.ReadEntities<Entity>("MyCollectionName");
  

Database Entities

In support of communication between the database and the calling code, a BaseEntity class is included that will provide a basic entity framework that can be used to create and manage entities in the database through the calling code.

I.e.

  public class MyEntity : BaseEntity 
  {
    public int MyAttribute { get; set; }
    public string MyAttribute { get; set; }
  }

Github

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.1 174 4/25/2023
1.0.0 195 2/2/2023