Walle.Components.MongoDB
2.0.0
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 Walle.Components.MongoDB --version 2.0.0
NuGet\Install-Package Walle.Components.MongoDB -Version 2.0.0
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="Walle.Components.MongoDB" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Walle.Components.MongoDB --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Walle.Components.MongoDB, 2.0.0"
#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 Walle.Components.MongoDB as a Cake Addin
#addin nuget:?package=Walle.Components.MongoDB&version=2.0.0
// Install Walle.Components.MongoDB as a Cake Tool
#tool nuget:?package=Walle.Components.MongoDB&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Walle.Components.MongoDB
happy code-first using MongoDB
Installations
Package Manager:
Install-Package Walle.Components.MongoDB -Version 1.0.0
.NetCore CLI:
dotnet add package Walle.Components.MongoDB --version 1.0.0
Configurations
- add the follow section into
appsettings.json
:
{
"MongoDBConfig": {
"ConnectionStr": "mongodb://127.0.0.1:27017/walle",
"DatabaseName": "walle"
}
}
- register dependency in your
Startup.cs
private IConfiguration Configuration { get; }
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
services.ConfigureMongoDB(Configuration);
}
Samples
- Inherited an entity from MongoEntity which will be a collection model.
using Walle.Components.MongoDB;
namespace Demo
{
public class ActivityModel : MongoEntity
{
public string Name { get; set; }
public string Description { get; set; }
}
}
- using
IMongoDBCollection<T>
to doIQueryable
operations with LINQ.
using Demo;
using Walle.Components.MongoDB;
namespace Demo.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ActivityController : ControllerBase
{
private IMongoDBCollection<ActivityModel> ActivityCollection { get; }
public ActivityController(IMongoDBCollection<ActivityModel> collection)
{
this.ActivityCollection = collection;
}
[HttpGet]
public RespList<ActivityModel> GetAll()
{
RespList<ActivityModel> resp = new RespList<ActivityModel>();
try
{
var sources = ActivityCollection.AsQueryable()?.ToList();
resp.Message = $"success.";
resp.Data = sources;
}
catch (Exception ex)
{
resp.Code = (int)RespCode.Exception;
resp.IsSuccess = false;
}
return resp;
}
}
}
- using
IMongoDBClient
to get the mongodb client for more operations.
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Walle.Components.MongoDB;
namespace Demo.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DemoController : ControllerBase
{
private IMongoDBClient Client { get; }
public DemoController(IMongoDBClient Client)
{
this.Client = Client;
}
[HttpGet]
public RespList<ActivityModel> GetAll()
{
RespList<ActivityModel> resp = new RespList<ActivityModel>();
try
{
var results = Client.Find<ActivityModel>(p => p.Name == "Misaya").ToList();
resp.Data = results;
}
catch (Exception )
{
var msg = "Exception occured when query activity.";
}
return resp;
}
}
}
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 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.
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 3.1.7)
- Microsoft.Extensions.DependencyInjection (>= 3.1.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.7)
- Microsoft.Extensions.Logging (>= 3.1.0)
- Microsoft.Extensions.Options (>= 3.1.7)
- MongoDB.Driver (>= 2.11.1)
- System.Text.Json (>= 4.7.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Walle.Components.MongoDB:
Package | Downloads |
---|---|
Walle.Components.Authentication
open-using authentication middleware. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
3.0.0.16 | 365 | 12/24/2021 | |
3.0.0.15 | 521 | 4/6/2021 | |
3.0.0.14 | 339 | 4/6/2021 | |
3.0.0.13 | 792 | 3/19/2021 | |
3.0.0.12 | 390 | 3/11/2021 | |
3.0.0.11 | 384 | 3/11/2021 | |
3.0.0.10 | 481 | 3/3/2021 | |
3.0.0.9 | 366 | 2/20/2021 | |
2.583167639.4 | 499 | 2/20/2021 | |
2.6.0.8 | 409 | 2/20/2021 | |
2.0.16 | 456 | 2/19/2021 | |
2.0.15 | 482 | 2/19/2021 | |
2.0.14 | 484 | 2/19/2021 | |
2.0.13 | 470 | 2/19/2021 | |
2.0.12 | 495 | 2/19/2021 | |
2.0.5.583178559 | 468 | 2/20/2021 | |
2.0.3 | 377 | 2/19/2021 | |
2.0.2 | 450 | 2/19/2021 | |
2.0.1 | 438 | 2/19/2021 | |
2.0.0.583188719 | 446 | 2/20/2021 | |
2.0.0.7 | 407 | 2/20/2021 | |
2.0.0 | 472 | 2/19/2021 | |
1.0.1 | 1,186 | 9/7/2020 | |
1.0.0 | 556 | 9/2/2020 |