Twileloop.UOW
2.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Twileloop.UOW --version 2.0.0
NuGet\Install-Package Twileloop.UOW -Version 2.0.0
<PackageReference Include="Twileloop.UOW" Version="2.0.0" />
paket add Twileloop.UOW --version 2.0.0
#r "nuget: Twileloop.UOW, 2.0.0"
// Install Twileloop.UOW as a Cake Addin #addin nuget:?package=Twileloop.UOW&version=2.0.0 // Install Twileloop.UOW as a Cake Tool #tool nuget:?package=Twileloop.UOW&version=2.0.0
<br /> <div align="center"> <a href="https://github.com/sangeethnandakumar/Twileloop.UOW"> <img src="https://iili.io/HeD5SzG.png" alt="Logo" width="80" height="80"> </a>
<h2 align="center"> Twileloop UOW (With LiteDB) </h2> <h4 align="center"> Free | Open-Source | Fast </h4> </div>
About
A lightweight and ready-made implementation of unit of work pattern + LiteDB. With ability to use multiple LiteDB databases, ready-made CRUD operations repository, LiteDB's native transactions and thread-safe features.
A plug & play package where you don't need to write lot and lot and lots of code to setp repositories and stuff. It's easy as 2 steps below
License
Twileloop.UOW is licensed under the MIT License. See the LICENSE file for more details.
This library is absolutely free. If it gives you a smile, A small coffee would be a great way to support my work. Thank you for considering it!
Usage
1. Register all databases
builder.Services.AddUnitOfWork((uow) => {
uow.Connections = new List<LiteDBConnection>
{
new LiteDBConnection("<DB_NAME_1>", "Filename=DatabaseA.db; Mode=Shared; Password=****;"),
new LiteDBConnection("<DB_NAME_2>", "Filename=DatabaseB.db; Mode=Shared; Password=****;")
};
});
2. Inject and Use as required
[ApiController]
public class HomeController : ControllerBase
{
private readonly UnitOfWork uow;
public HomeController(UnitOfWork uow)
{
this.uow = uow;
}
[HttpGet]
public IActionResult Get()
{
try
{
// Step 1: Point to a database
uow.UseDatabase("<DB_NAME>");
//Step 2: Get a repository for your model 'Dogs'
var dogRepo = uow.GetRepository<Dogs>();
//Step 3: Do some fetch
allDogs = dogRepo.GetAll().ToList();
//Step 4: Or any CRUD operations you like
dogRepo.Add(new Dog());
//Step 5: Finally, commit or rollback if transaction need to maintain. That's it
uow.Commit();
return Ok(allDogs);
}
catch(Exception)
{
uow.Rollback();
}
}
}
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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- LiteDB (>= 5.0.16)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.