Prakrishta.Data
1.0.0
Install-Package Prakrishta.Data -Version 1.0.0
dotnet add package Prakrishta.Data --version 1.0.0
<PackageReference Include="Prakrishta.Data" Version="1.0.0" />
paket add Prakrishta.Data --version 1.0.0
#r "nuget: Prakrishta.Data, 1.0.0"
// Install Prakrishta.Data as a Cake Addin
#addin nuget:?package=Prakrishta.Data&version=1.0.0
// Install Prakrishta.Data as a Cake Tool
#tool nuget:?package=Prakrishta.Data&version=1.0.0
Prakrishta.Data
Generic Repository and Unit of work pattern with EF.Core
Package installer:
Install-Package Prakrishta.Data
Easy to create Unit of work and repository.
IUnitOfWork unitOfWork = new UnitOfWork<DatabaseContext>(databaseContext);
var readRepository = unitOfWork.GetReadRepository<User>();
if need to create CRUD repository,
var readRepository = unitOfWork.GetCrudRepository<User>();
The unit of work can be injected using any IoC containers as well. There is an extension to add Unit of work with .net core middleware.
services.AddUnitOfWork<urdbcontextclass>();
Once unit of work is added to middleware, can be injected to controller or whereever requires. The following example shows construction injection in controller and it's usage
private readonly IUnitOfWork<UserContext> _uow;
public UserController(IUnitOfWork<UserContext> uow)
{
this._uow = uow;
}
[HttpGet]
public ActionResult<IEnumerable<User>> Get()
{
var userList = this._uow.GetReadRepository<User>().GetAll();
}
The repository has both synchronous and asynchronous methods and also supports pagination as well. The associated tables can also queried through "Included" parameter, for example if user detail requires relevant entity "Address" as well then the following code snippet will do the job.
[HttpGet]
public ActionResult<IEnumerable<User>> Get()
{
var userList = this._uow.GetReadRepository<User>().GetAll("Address");
}
All of the read methods support filtering and has support for sorting, record change tracking.
The code base is licensed under open source, please feel free to use it in your project or edit as per your need.
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- Microsoft.EntityFrameworkCore (>= 2.2.1)
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.0 | 476 | 2/7/2019 |