ConnectionHU 1.2.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ConnectionHU --version 1.2.1
                    
NuGet\Install-Package ConnectionHU -Version 1.2.1
                    
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="ConnectionHU" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConnectionHU" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="ConnectionHU" />
                    
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 ConnectionHU --version 1.2.1
                    
#r "nuget: ConnectionHU, 1.2.1"
                    
#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 ConnectionHU@1.2.1
                    
#: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=ConnectionHU&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=ConnectionHU&version=1.2.1
                    
Install as a Cake Tool

DynamicBuilder para consultas SQL dinámicas con Dapper

La clase DynamicBuilder permite construir y ejecutar de forma fluida y segura consultas SQL (SELECT, INSERT, UPDATE, DELETE, y consultas personalizadas) utilizando Dapper, con soporte para filtros, joins, alias, y transacciones en múltiples dialectos SQL.

🚀 Características

  • Fluent API para construir consultas dinámicas.
  • Soporte para múltiples bases de datos vía SqlDialect.
  • Filtros dinámicos con validación (FilterRule).
  • Soporte para JOIN con múltiples condiciones (ON, AND).
  • Ejecución segura usando Dapper.
  • Manejo de errores personalizado.
  • Soporte para transacciones opcionales.
  • Registra las consultas ejecutadas en archivos .log.

🧱 Requisitos

  • .NET 6 o superior.
  • Dapper
  • Las siguientes clases/utilidades deben estar implementadas:
    • FilterRule, CriterioJoin, CriterioON, Criterio
    • SqlDialect, IOperationsSQL, ConcreteConnectionFactory
    • BuildSql, Files, Utilities
    • Excepciones personalizadas como ExceptionForArguments, ExceptionQuery, ExceptionExecute

🛠️ Uso básico

var connection = new SqlConnection("connection_string");
var builder = new DynamicBuilder(connection, SqlDialect.SqlServer);

var result = await builder
    .Schema("dbo")
    .Select("Usuarios", new[] { "Id", "Nombre" })
    .Where(new FilterRule { Field = "Activo", Operator = "=", Value = true })
    .ExecuteAsync();

📌 Métodos disponibles

Método Descripción
Schema(string) Establece el esquema de la tabla (por defecto: dbo).
Table(string) Establece el nombre de la tabla.
Select(string, string[]) Define la tabla y columnas a consultar.
Where(...) Aplica condiciones de filtro (FilterRule).
Join(...) Agrega cláusulas JOIN.
On(...) Agrega condiciones de unión entre tablas.
And(...) Agrega condiciones adicionales a los JOIN.
ExecuteAsync() Ejecuta un SELECT.
InsertAsync(object) Ejecuta un INSERT.
UpdateAsync(object, List<Criterio>) Ejecuta un UPDATE.
DeleteAsync(List<Criterio>) Ejecuta un DELETE.
QueryStatementSQL(...) Ejecuta una consulta SQL personalizada.
ExcecuteStatementSQL(...) Ejecuta un comando SQL personalizado.

📄 Ejemplo de Insert

await builder
    .Table("Usuarios")
    .InsertAsync(new { Nombre = "Juan", Activo = true });

🔄 Ejemplo de Update

await builder
    .Table("Usuarios")
    .UpdateAsync(
        new { Activo = false },
        new List<Criterio> { new Criterio { Field = "Id", Operator = "=", Value = 1 } }
    );

🧹 Ejemplo de Delete

await builder
    .Table("Usuarios")
    .DeleteAsync(
        new List<Criterio> { new Criterio { Field = "Id", Operator = "=", Value = 1 } }
    );

📌 Notas

  • Los métodos Join(), On() y And() deben usarse en conjunto y en orden.
  • Las condiciones (Where, On, And) se validan automáticamente.
  • Las consultas ejecutadas se guardan en archivos .log por día.
  • Manejo de errores centralizado mediante excepciones específicas del dominio.

🧩 Extensiones futuras

  • Soporte para ORDER BY, GROUP BY.
  • Soporte para TOP, LIMIT, OFFSET.
  • Soporte para subconsultas.

📬 Contribuciones

Este builder está diseñado para ser modular y fácilmente extensible. Se agradecen sugerencias o mejoras.

⚖️ Licencia

Este proyecto está bajo una licencia privada/empresarial. Modifica esta sección según corresponda.

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 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 is compatible.  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

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