GH.MongoDb.GenericRepository
2.0.7
See the version list below for details.
dotnet add package GH.MongoDb.GenericRepository --version 2.0.7
NuGet\Install-Package GH.MongoDb.GenericRepository -Version 2.0.7
<PackageReference Include="GH.MongoDb.GenericRepository" Version="2.0.7" />
paket add GH.MongoDb.GenericRepository --version 2.0.7
#r "nuget: GH.MongoDb.GenericRepository, 2.0.7"
// Install GH.MongoDb.GenericRepository as a Cake Addin #addin nuget:?package=GH.MongoDb.GenericRepository&version=2.0.7 // Install GH.MongoDb.GenericRepository as a Cake Tool #tool nuget:?package=GH.MongoDb.GenericRepository&version=2.0.7
Generic MongoDb Repository .Net Core 2.0
Synopsis
Is an repository pattern implementation for mongodb. It contains abstract classes for CRUD operations.
Code Example
You must create classes derived from IDocument and the repositories derived from GenericRepositoryAsync or GenericBucketRepositoryAsync or GenericGeoRepositoryAsync:
public class Person: IDocument<ObjectId>
{
public ObjectId Id {get; set;}
public string FirstName {get; set;}
public string LastName {get; set;}
}
public sealed class PeopleRepositoryAsync:GenericRepositoryAsync<Person, ObjectId>
{
public PeopleRepositoryAsync(IMongoDbConnector connector) : base(connector, "people")
{
}
}
"people" is collection name. then you can use repository:
var myConnector = new MongoDbConnector("localhost", "mydatabase")
var myRepo = new PeopleRepositoryAsync(myConnector)
myRepo.Get() //return all people in my collection
myRepo.Get(myID) //return person with myID as id
myRepo.Get(p=> p.FirstName == "John") //return all people who have name john
and so on..
Installation
by NUGET
Install-Package GH.MongoDb.GenericRepository
Product | Versions 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 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- MongoDB.Driver (>= 2.4.4)
- MongoDB.Driver.GridFS (>= 2.4.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on GH.MongoDb.GenericRepository:
Package | Downloads |
---|---|
GH.MongoDb.GenericRepository.BucketExtension
Add GridFs features to GH.MongoDb.GenericRepository |
|
GH.MongoDb.GenericRepository.GeoExtension
Add Geographic query extension to GH.MongoDb.GenericRepository |
GitHub repositories
This package is not used by any popular GitHub repositories.
add connection setting and delivery strategy