EQP.EFRepository.Core 1.3.9

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

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

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 465 10/6/2023
6.1.0 749 2/6/2023
6.0.3 765 1/31/2023
6.0.2 1,075 8/3/2022
6.0.0 1,034 5/30/2022
3.9.14 1,016 6/8/2022
3.9.12 985 5/18/2022
3.9.11 946 5/16/2022
3.9.10 1,041 4/19/2022
3.9.9 1,010 4/5/2022
3.9.8 981 3/31/2022
3.9.7 1,005 3/11/2022
3.9.6 1,047 2/25/2022
3.9.5 1,021 2/21/2022
3.9.4 1,003 2/17/2022
3.9.3 1,059 1/28/2022
3.9.2 1,008 1/27/2022
3.9.1 1,047 1/19/2022
3.9.0 1,037 1/17/2022
3.8.1 798 12/27/2021
3.8.0 800 12/23/2021
3.7.14 818 12/22/2021
3.7.13 781 12/20/2021
3.7.12 787 12/20/2021
3.7.11 787 12/13/2021
3.7.10 832 12/3/2021
3.7.9 1,325 12/1/2021
3.7.8 812 11/29/2021
3.7.7 2,542 11/26/2021
3.7.5 2,020 11/26/2021
3.7.4 849 11/23/2021
3.7.3 908 11/19/2021
3.7.2 891 10/20/2021
3.7.1 855 10/6/2021
3.7.0 889 9/30/2021
3.6.1 829 9/24/2021
3.6.0 866 9/22/2021
3.5.0 909 9/2/2021
3.4.9 894 8/24/2021
3.4.8 900 8/6/2021
3.4.7 868 8/5/2021
3.4.6 928 7/29/2021
3.4.5 875 7/27/2021
3.4.4 871 7/26/2021
3.4.3 904 7/22/2021
3.4.2 945 7/9/2021
3.4.1 941 7/1/2021
3.4.0 927 7/1/2021
3.3.8 900 6/22/2021
3.3.7 872 6/21/2021
3.3.6 917 6/18/2021
3.3.5 966 6/15/2021
3.2.5 814 5/14/2021
3.2.4 858 4/28/2021
3.2.3 835 4/27/2021
3.2.2 834 4/16/2021
3.2.1 862 4/9/2021
3.2.0 836 3/30/2021
3.1.5 841 3/29/2021
3.1.4 840 3/22/2021
3.1.1 915 3/15/2021
3.1.0 939 3/10/2021
3.0.8 976 3/8/2021
3.0.7 920 3/5/2021
3.0.6 976 2/23/2021
3.0.5 934 1/29/2021
3.0.4 925 1/26/2021
3.0.2 911 1/25/2021
2.0.8 933 1/18/2021
2.0.7 950 12/31/2020
2.0.6 1,006 12/24/2020
2.0.5 975 12/2/2020
2.0.4 910 11/25/2020
2.0.3 936 11/24/2020
2.0.1 978 11/24/2020
1.3.9 969 11/10/2020
1.3.8 971 11/9/2020
1.3.2 1,067 10/14/2020
1.2.0 1,006 9/7/2020