Prakrishta.Data
1.0.0
dotnet add package Prakrishta.Data --version 1.0.0
NuGet\Install-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 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. |
-
.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 | 703 | 2/7/2019 |