qs.LibPack 8.1.0

dotnet add package qs.LibPack --version 8.1.0
                    
NuGet\Install-Package qs.LibPack -Version 8.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="qs.LibPack" Version="8.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="qs.LibPack" Version="8.1.0" />
                    
Directory.Packages.props
<PackageReference Include="qs.LibPack" />
                    
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 qs.LibPack --version 8.1.0
                    
#r "nuget: qs.LibPack, 8.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 qs.LibPack@8.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=qs.LibPack&version=8.1.0
                    
Install as a Cake Addin
#tool nuget:?package=qs.LibPack&version=8.1.0
                    
Install as a Cake Tool

qsLibPack

NuGet .NET

Biblioteca base com utilitários para DDD, CQRS, Repositórios, Validações e Extensões.

Instalação

dotnet add package qs.LibPack --version 8.1.0

Exemplos

Básico

Registrar o serviço de validação e utilizá-lo em qualquer camada.

using Microsoft.Extensions.DependencyInjection;
using qsLibPack.Validations.IoC;
using qsLibPack.Validations.Interface;

var services = new ServiceCollection();
services.AddValidationService();
var provider = services.BuildServiceProvider();

var validation = provider.GetRequiredService<IValidationService>();
validation.AddErrors("Email", "Email inválido");
var ok = validation.IsValid(); // false

Intermediário

Criar uma unidade de trabalho e orquestrar validação dentro de um serviço de aplicação.

using System.Threading;
using System.Threading.Tasks;
using qsLibPack.Repositories.Interfaces;
using qsLibPack.Validations.Interface;
using qsLibPack.Application;

public sealed class EfUnitOfWork : IUnitOfWork
{
    private readonly Microsoft.EntityFrameworkCore.DbContext db;
    public EfUnitOfWork(Microsoft.EntityFrameworkCore.DbContext db) { this.db = db; }
    public Task CommitAsync(CancellationToken ct = default) => db.SaveChangesAsync(ct);
}

public sealed class UserService : ApplicationService
{
    public UserService(IValidationService v, IUnitOfWork uow) : base(v, uow) { }

    public async Task CreateAsync(User entity, CancellationToken ct = default)
    {
        entity.Validate();
        if (!_validationService.IsValid()) return;
        await _uow.CommitAsync(ct);
    }
}

Avançado

Integrar validação ao pipeline HTTP com ApiLibController e middleware.

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using qsLibPack.Controllers;
using qsLibPack.Validations.IoC;
using qsLibPack.Validations.Interface;
using qsLibPack.Middlewares;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddValidationService();
var app = builder.Build();
app.UseValidationService();
app.MapControllers();
app.Run();

public sealed class UsersController : ApiLibController
{
    private readonly IValidationService validation;
    public UsersController(IValidationService v) : base(v) { validation = v; }

    [HttpPost("/users")]
    public IActionResult Post(UserDto dto)
    {
        if (string.IsNullOrEmpty(dto.Email))
            validation.AddErrors("Email", "Obrigatório");

        return Result(Ok());
    }
}

Informações do NuGet

  • Versão atual: 8.1.0
  • Dependências:
    • FluentValidation 12.1.0
    • Microsoft.Extensions.DependencyInjection 8.*
    • Microsoft.Extensions.Options.ConfigurationExtensions 8.*
    • FrameworkReference para Microsoft.AspNetCore.App (controllers e middleware)
  • Compatibilidade: .NET 8 (net8.0)
  • Nullable reference types habilitado
  • Link direto: https://www.nuget.org/packages/qs.LibPack/
  • Histórico (resumo):
    • 8.0.0: migração para .NET 8, melhorias nas validações e organização dos pacotes
    • 8.1.0: Entity<TId>.Equals com checagem de tipo; EmailVO à prova de ReDoS; PasswordVO.ToString() mascarado (***) e métodos renomeados para CryptPassword/EqualsCrypt (aliases antigos [Obsolete]); ValidationMiddleware migrado para System.Text.Json; IRepository.GetByID/GetByIDAsync agora retornam tipo anulável; FrameworkReference no lugar dos pacotes ASP.NET legados; Nullable habilitado

Como Contribuir

  • Abra issues e PRs no repositório principal
  • Siga o versionamento semântico (MAJOR.MINOR.PATCH)
  • Execute testes localmente antes de enviar alterações
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 (4)

Showing the top 4 NuGet packages that depend on qs.LibPack:

Package Downloads
qs.Account

Pacote para integração com qs.Account

qs.LibPack.UseCases

Abstrações de Use Cases seguindo Clean Architecture, com padrão MediatR-like, behaviors e DI.

qs.LibPack.EF

Integração Entity Framework Core para qsLibPack: Repositórios e consultas.

qs.LibPack.MongoDB

Integração MongoDB para qsLibPack: Contexto, Repositório e IoC.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.0 255 6/13/2026
8.0.0 408 11/25/2025
6.1.3 969 12/27/2022
6.1.2 750 7/8/2022
6.1.1 656 7/8/2022
6.1.0 678 6/22/2022
6.0.0 806 5/10/2022
1.3.0 863 5/5/2021
1.2.0 808 5/5/2021