FrameworkRepository 1.0.7

dotnet add package FrameworkRepository --version 1.0.7                
NuGet\Install-Package FrameworkRepository -Version 1.0.7                
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="FrameworkRepository" Version="1.0.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FrameworkRepository --version 1.0.7                
#r "nuget: FrameworkRepository, 1.0.7"                
#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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.7 2,736 5/24/2023
1.0.3 1,429 3/23/2022
1.0.2 482 2/11/2022
1.0.1 1,042 2/7/2022
1.0.0 1,503 12/10/2021