ItMastersPro.MongoDb.Repository 1.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package ItMastersPro.MongoDb.Repository --version 1.0.9
NuGet\Install-Package ItMastersPro.MongoDb.Repository -Version 1.0.9
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="ItMastersPro.MongoDb.Repository" Version="1.0.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ItMastersPro.MongoDb.Repository --version 1.0.9
#r "nuget: ItMastersPro.MongoDb.Repository, 1.0.9"
#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 ItMastersPro.MongoDb.Repository as a Cake Addin
#addin nuget:?package=ItMastersPro.MongoDb.Repository&version=1.0.9

// Install ItMastersPro.MongoDb.Repository as a Cake Tool
#tool nuget:?package=ItMastersPro.MongoDb.Repository&version=1.0.9

ItMastersPro.MongoDb.Repository

Implementation the Repository and Unit-of-Work patterns for use MongoDb on .Net Core

Getting Started

Use package is very simple:

Step 1:

Import the package, using the command

Install-Package ItMastersPro.MongoDb.Repository 

Step 2:

You need to create an appetting.json file in every test project and specify the parameters of the connection string to MongoDB database.

{
  "MongoConnection": {
    "ConnectionString": "mongodb://username:password@host:port/<DatabaseName>?ssl=true"
  }
}

Step 3:

Add service to the container

services.UseMongoDb(Configuration.GetSection("MongoConnection:ConnectionString").Value);

Step 4:

Inherit the class from the interface csharp IEntity. The rest of the package will do all logic for you.

 public class Post : IEntity
{
	public DateTime Date { get; set; }
	public string Author { get; set; }
	...
}

Step 5:

Implement the interface in the controller

private readonly IMongoDbContext _mongoDbContext;
private readonly IRepository<Post> _postRepository;

public HomeController(IRepository<Post> postRepository, IMongoDbContext mongoDbContext)
{
	_mongoDbContext = mongoDbContext;
	_postRepository = postRepository;
}

Alternate path for implement the interface shown in DependencyInjectionUnitTests.cs.

Step 6:

It's all. Now you can access the methods via the interface variable, like this

_postRepository.Insert(new Post() {Author = "Author", Date = DateTime.Now});

Addition

At the moment the library implements simple methods: Insert, Updage, Delete, Find (search one record), Query (search multiple record). We tried to make the code intuitive, in addition, we supplemented it with an annotation. You can also see unit tests as an example. Autogenerated documentation you find here.

Running the tests

To run the tests correctly, you need to create an appetting.json file in every test project. You must also specify the parameters of the connection string to MongoDB database.

{
  "MongoConnection": {
    "ConnectionString": "mongodb://username:password@host:port/<DatabaseName>?ssl=true"
  }
}

If you have problems while integration tests execute

Sometimes integration tests may fail to perform. This is due to the fact that the IDE runs them in parallel in different threads. Therefore, if this happens, run tests that have not been tested separately.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the repository of packages.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Happy nice code!
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
2.0.2 1,288 4/5/2018
1.2.2 1,044 4/3/2018
1.1.12 1,148 3/16/2018
1.1.9 1,092 2/21/2018
1.1.5 1,050 2/12/2018
1.0.9 1,119 2/2/2018
1.0.5 1,131 2/1/2018