Syntrony.Repositories 1.1.0

dotnet add package Syntrony.Repositories --version 1.1.0
                    
NuGet\Install-Package Syntrony.Repositories -Version 1.1.0
                    
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="Syntrony.Repositories" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Syntrony.Repositories" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Syntrony.Repositories" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Syntrony.Repositories --version 1.1.0
                    
#r "nuget: Syntrony.Repositories, 1.1.0"
                    
#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.
#:package Syntrony.Repositories@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Syntrony.Repositories&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Syntrony.Repositories&version=1.1.0
                    
Install as a Cake Tool

Syntrony.Repositories

Contrato de repositorio generico, agnostico de motor de persistencia — equivalente a IRepository<TEntity, TKey> de ABP, recortado a lo que se usa — junto con las interfaces de entidad (IEntity<TKey>), las clases base (Entity<TKey>, CreationAuditedEntity<TKey>, AuditedEntity<TKey>, FullAuditedEntity<TKey>) y las convenciones de auditoria/soft-delete (ISoftDelete, ICreationAudited, IModificationAudited, IDeletionAudited...) que las implementaciones deben respetar. Un app service depende de este contrato sin conocer el backend real.

Sin dependencias de EF Core, Mongo ni ASP.NET Core — solo depende del nucleo Syntrony para los contratos de excepcion (IHasHttpStatusCode, IHasLogSeverity). Las implementaciones por motor (Syntrony.EntityFrameworkCore.Repositories hoy, Mongo si aparece) dependen de esta interfaz, no al reves.

Installation

dotnet add package Syntrony.Repositories

Implementing a provider

RepositoryBase<TEntity, TKey> resuelve con LINQ sobre IQueryable todo lo que no requiere conocimiento del motor de persistencia. Un proveedor nuevo solo implementa cinco metodos:

public class InMemoryRepository<TEntity, TKey> : RepositoryBase<TEntity, TKey>
    where TEntity : class, IEntity<TKey>
{
    private readonly List<TEntity> _items;

    public InMemoryRepository(IEnumerable<TEntity>? seed = null) => _items = seed?.ToList() ?? [];

    public override IQueryable<TEntity> GetAll() => _items.AsQueryable();
    public override IQueryable<TEntity> GetAllReadonly() => _items.AsQueryable();

    public override Task<TEntity> InsertAsync(TEntity entity, CancellationToken ct = default)
    {
        _items.Add(entity);
        return Task.FromResult(entity);
    }

    public override Task<TEntity> UpdateAsync(TEntity entity, CancellationToken ct = default)
        => Task.FromResult(entity);

    public override Task DeleteAsync(TEntity entity, CancellationToken ct = default)
    {
        _items.Remove(entity);
        return Task.CompletedTask;
    }
}

Un proveedor serio (EF Core, Mongo) deberia ademas sobreescribir GetAllListAsync, CountAsync y LongCountAsync con las versiones async nativas del motor — la base las resuelve por defecto enumerando sincronamente sobre IQueryable, correcto pero no optimo.

Status

Contrato e implementaciones base completos: interfaces de entidad, IRepository<TEntity, TKey>, RepositoryBase<TEntity, TKey>, las clases base de entidad y las excepciones de dominio (EntityNotFoundException, ConcurrencyException). Listo para publicar 1.0.0.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Syntrony.Repositories:

Package Downloads
Syntrony.EntityFrameworkCore.Repositories

EF Core implementation of the Syntrony.Repositories contract: EfCoreRepositoryBase<TDbContext,TEntity,TKey>, automatic registration of the generic repository (both IRepository<TEntity,TKey> and the IRepository<TEntity> shortcut) and the IUnitOfWorkParticipant that enlists a DbContext in Syntrony's unit of work. Equivalent to ABP's EfCoreRepositoryBase and EfCoreUnitOfWork. Provider-agnostic: depends only on Microsoft.EntityFrameworkCore.Relational, never on Npgsql or SqlServer.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 71 10/3/2026
1.0.0 63 10/3/2026