FrameworkRepository 1.0.7
dotnet add package FrameworkRepository --version 1.0.7
NuGet\Install-Package FrameworkRepository -Version 1.0.7
<PackageReference Include="FrameworkRepository" Version="1.0.7" />
paket add FrameworkRepository --version 1.0.7
#r "nuget: FrameworkRepository, 1.0.7"
// Install FrameworkRepository as a Cake Addin #addin nuget:?package=FrameworkRepository&version=1.0.7 // Install FrameworkRepository as a Cake Tool #tool nuget:?package=FrameworkRepository&version=1.0.7
Framework Repository
A class library that implements the generic repository pattern using Entity Framework Core as base.
Usage
First register repositories interfaces and classes in dependency injection using the automatic registration method.
builder.Services.AddRepositories();
Note: All repositories are registered with a scoped lifetime, to change that you can use the optional parameter and assign a lifetime from these options (Transient, Scoped And Singleton).
builder.Services.AddRepositories(ServiceLifetime.Transient);
After that you can use the repository interfaces through constructor injection.
public Test(IReadOnlyRepository<User, DefaultDbContext> readonOnlyRepository,
IRepository<User, DefaultDbContext> repository,
ITransactionRepository<User, DefaultDbContext> transactionRepository,
IRawRepository<DefaultDbContext> rawRepository)
{
}
The User
type is an Entity Framework Core POCO class which represents a table,
while DefaultDbContext
is the DbContext which will be requested by the repository when created by the IOC.
Each repository interface have it's own usage.<br/><br/>
The IReadOnlyRepository<>
can only retrieve data.<br/><br/>
The IRepository<>
can retrieve data and add/update/delete entities.<br/><br/>
The ITransactionRepository<>
can do the same functions as IRepository<>
but with two extra methods SaveChanges()
which commits data and CreateTransaction()
which creates a transaction (if non exists) and returns it.<br/><br/>
The IRawRepository<>
has different methods that receives a string command/procedure and a list of parameters to execute.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Microsoft.EntityFrameworkCore (>= 6.0.16)
- Microsoft.EntityFrameworkCore.Relational (>= 6.0.16)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.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.