EQP.EFRepository.Core 2.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package EQP.EFRepository.Core --version 2.0.6
NuGet\Install-Package EQP.EFRepository.Core -Version 2.0.6
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="EQP.EFRepository.Core" Version="2.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EQP.EFRepository.Core --version 2.0.6
#r "nuget: EQP.EFRepository.Core, 2.0.6"
#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 EQP.EFRepository.Core as a Cake Addin
#addin nuget:?package=EQP.EFRepository.Core&version=2.0.6

// Install EQP.EFRepository.Core as a Cake Tool
#tool nuget:?package=EQP.EFRepository.Core&version=2.0.6

EQP.EFRepository.Core

Pacchetto che implementa il pattern UnitOfWork & Repository e permette la centralizzazione di interfacce, modelli, repository (con operazioni CRUD di base) e servizi basati su database gestiti tramite Entity Framework Core.

Per la gestione dei modelli sono esposte le seguenti interfacce:

  • IPrimaryKeyEntity<TPrimaryKey>: interfaccia che permette di attribuire la proprietà ID (identificativo univoco) a un modello e indicarne il tipo (TPrimaryKey sarà il tipo primitivo da attribuire alla primary key)
  • IBaseEntity: interfaccia che implementa la IPrimaryKeyEntity<int> definendo già la primary key come campo intero. I modelli che implementano questa interfaccia avranno sempre la proprietà ID di tipo int
  • IBaseStringEntity: interfaccia che implementa la IPrimaryKeyEntity<int> definendo la primary key come campo di tipo string. I modelli che implementano questa interfaccia avranno sempre la proprietà ID di tipo string
  • IAuditEntity: interfaccia che permette l'implementazione delle proprietà necessarie all'audit, quindi identificativo dell'utente che esegue una insert o update sui dati di un certo modello, e le date di inserimento e modifica di un record
  • ISoftDeleteEntity: interfaccia che permette la gestione della cancellazione logica. I modelli che implementano questa interfaccia non verranno cancellati fisicamente dal database ma solo logicamente. Inoltre verrà tenuto traccia dell'identificativo dell'utente che esegue la soft delete e la data in cui è avvenuta tale cancellazione
  • IDisableEntity: interfaccia che permette la gestione della disattivazione/attivazione di un'entità. I modelli che implementano questa interfaccia potranno essere disabilitati in modo da impedirne la ricerca ma lasciarli comunque visibili in alcune sezioni.
  • IUnitOfWork: interfaccia che permette la gestione di più unit of work e quindi di più connessioni e transazioni su stesso db o db differenti.
  • ISessionModel: interfaccia utilizzata per centralizzare dati di sessione riutilizzabili all'interno di repository e servizi. L'interfaccia implementa solo la proprietà User di tipo IBaseEntity. Al momento viene usata, se definita, solo per la scrittura dei dati di audit per le entità che implementano l'interfaccia IAuditEntity

Livello di accesso ai dati

UnitOfWork

Centralizza l'esecuzione delle operazioni CRUD e la gestione delle transazioni sul contesto del database. Implementa l'interfaccia IUnitOfWork per fare in modo di poter gestire più database e quindi più UnitOfWork. Per poter essere istanziata è necessario passare nel costruttore l'istanza del DbContext da utilizzare. I metodi esposti da questa classe sono:

  • SaveChanges() : scrive sul database tutte le modifiche pendenti tracciate nell'istanza del DbContext passata nel costruttore
  • BeginTransaction(): apre una nuova transazione sull'istanza del DbContext passata nel costruttore. Se esiste già una transazione aperta sul DbContext genera un'eccezione.
  • CommitTransaction() esegue la commit della transazione aperta sull'istanza del DbContext passata nel costruttore. Se non ci sono transazioni aperte genera un'eccezione.
  • RollbackTransaction() esegue il rollback transazione aperta sull'istanza del DbContext passata nel costruttore. Se non ci sono transazioni aperte genera un'eccezione.
  • GetIdentityRepository<TRepository, TEntity>(): utilizza la reflection per restituire una nuova istanza del repository avente tipo uguale al TRepository definito.

IRepository

Interfaccia che permette la centralizzazione di tutte le operazioni CRUD di base. Per poter implementare tale interfaccia è obbligatorio definire i seguenti tipi:

  • TEntity: tipo dell'entità gestita con EFCore e che deve implementare l'interfaccia IPrimaryKeyEntity<TPrimaryKey>
  • TPrimaryKey: tipo primitivo della primary key ID

L'interfaccia definisce i seguenti metodi:

  • void Save(TEntity entity):
  • TEntity Get(TPrimaryKey, params Expression<Func<TEntity, object>>[] includes):
  • IQueryable<TEntity> GetAll(Expression<Func<TEntity, object>>[] includes = null):
  • IQueryable<TEntity> GetBy(Expression<Func<TEntity, bool>> predicate, Expression<Func<TEntity, object>>[] includes = null):
  • void Delete(TEntity entity):
  • void Delete(TPrimaryKey ID):
  • bool Exists(TPrimaryKey ID):
  • bool Exists(Expression<Func<TEntity, bool>> predicate):
  • void WriteAuditData(TEntity auditEntity):
  • IQueryable<TEntity> IncludeMultiple(params Expression<Func<TEntity, object>>[] includes):

IdentityRepository

Questo repository implementa l'interfaccia IRepository definendo già il tipo TPrimaryKey come intero, pertanto tutte le classi che erediteranno da questo dovranno essere classi che gestiscono modelli la cui primary key è un intero. //TO DO

GenericRepository

//TO DO

Livello di gestione dei servizi centralizzati

//TO DO

IdentityService

//TO DO

GenericService

//TO DO

Product 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.1 is compatible. 
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
6.1.1 505 10/6/2023
6.1.0 757 2/6/2023
6.0.3 769 1/31/2023
6.0.2 1,092 8/3/2022
6.0.0 1,039 5/30/2022
3.9.14 1,020 6/8/2022
3.9.12 987 5/18/2022
3.9.11 947 5/16/2022
3.9.10 1,043 4/19/2022
3.9.9 1,011 4/5/2022
3.9.8 983 3/31/2022
3.9.7 1,006 3/11/2022
3.9.6 1,051 2/25/2022
3.9.5 1,022 2/21/2022
3.9.4 1,004 2/17/2022
3.9.3 1,063 1/28/2022
3.9.2 1,009 1/27/2022
3.9.1 1,048 1/19/2022
3.9.0 1,038 1/17/2022
3.8.1 800 12/27/2021
3.8.0 801 12/23/2021
3.7.14 820 12/22/2021
3.7.13 782 12/20/2021
3.7.12 788 12/20/2021
3.7.11 788 12/13/2021
3.7.10 833 12/3/2021
3.7.9 1,326 12/1/2021
3.7.8 814 11/29/2021
3.7.7 2,545 11/26/2021
3.7.5 2,021 11/26/2021
3.7.4 850 11/23/2021
3.7.3 909 11/19/2021
3.7.2 893 10/20/2021
3.7.1 856 10/6/2021
3.7.0 891 9/30/2021
3.6.1 831 9/24/2021
3.6.0 867 9/22/2021
3.5.0 911 9/2/2021
3.4.9 896 8/24/2021
3.4.8 901 8/6/2021
3.4.7 869 8/5/2021
3.4.6 930 7/29/2021
3.4.5 876 7/27/2021
3.4.4 872 7/26/2021
3.4.3 905 7/22/2021
3.4.2 946 7/9/2021
3.4.1 942 7/1/2021
3.4.0 928 7/1/2021
3.3.8 902 6/22/2021
3.3.7 873 6/21/2021
3.3.6 918 6/18/2021
3.3.5 969 6/15/2021
3.2.5 815 5/14/2021
3.2.4 860 4/28/2021
3.2.3 836 4/27/2021
3.2.2 835 4/16/2021
3.2.1 863 4/9/2021
3.2.0 838 3/30/2021
3.1.5 842 3/29/2021
3.1.4 841 3/22/2021
3.1.1 916 3/15/2021
3.1.0 940 3/10/2021
3.0.8 977 3/8/2021
3.0.7 921 3/5/2021
3.0.6 980 2/23/2021
3.0.5 936 1/29/2021
3.0.4 926 1/26/2021
3.0.2 912 1/25/2021
2.0.8 935 1/18/2021
2.0.7 952 12/31/2020
2.0.6 1,009 12/24/2020
2.0.5 976 12/2/2020
2.0.4 912 11/25/2020
2.0.3 937 11/24/2020
2.0.1 979 11/24/2020
1.3.9 971 11/10/2020
1.3.8 972 11/9/2020
1.3.2 1,071 10/14/2020
1.2.0 1,009 9/7/2020