RetailSolutions.Shared.Database 1.2.72

There is a newer version of this package available.
See the version list below for details.
dotnet add package RetailSolutions.Shared.Database --version 1.2.72
                    
NuGet\Install-Package RetailSolutions.Shared.Database -Version 1.2.72
                    
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="RetailSolutions.Shared.Database" Version="1.2.72" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RetailSolutions.Shared.Database" Version="1.2.72" />
                    
Directory.Packages.props
<PackageReference Include="RetailSolutions.Shared.Database" />
                    
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 RetailSolutions.Shared.Database --version 1.2.72
                    
#r "nuget: RetailSolutions.Shared.Database, 1.2.72"
                    
#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 RetailSolutions.Shared.Database@1.2.72
                    
#: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=RetailSolutions.Shared.Database&version=1.2.72
                    
Install as a Cake Addin
#tool nuget:?package=RetailSolutions.Shared.Database&version=1.2.72
                    
Install as a Cake Tool

RetailSolutions.Shared.Database

Biblioteca compartilhada para abstração de acesso a bancos de dados Oracle e SQL Server, fornecendo uma interface unificada e extensões úteis para operações comuns.

Características

  • Factory Pattern: Criação automática de conexões baseada na string de conexão
  • Suporte Multi-Banco: Oracle e SQL Server
  • Extensões Oracle: Configuração otimizada e geração de SQL statements
  • Query Extensions: Binding automático de parâmetros em queries
  • Integração Dapper: Suporte para DynamicParameters do Dapper

Instalação

Via NuGet

dotnet add package RetailSolutions.Shared.Database

Dependências

  • Dapper (2.1.66)
  • Microsoft.Data.SqlClient (6.1.3)
  • Oracle.ManagedDataAccess.Core (23.26.0)
  • Microsoft.Extensions.Configuration (10.0.0)
  • Microsoft.Extensions.DependencyInjection (10.0.0)
  • Microsoft.Extensions.Hosting (10.0.1)

Uso

DatabaseConnectionFactory

Cria conexões automaticamente baseado na string de conexão:

using RetailSolutions.Shared.Database;

// Oracle
var oracleConnection = DatabaseConnectionFactory.CreateDbConnection(
    "Data Source=localhost:1521/XE;User Id=user;Password=pass;"
);

// SQL Server
var sqlConnection = DatabaseConnectionFactory.CreateDbConnection(
    "Server=localhost;Database=MyDb;User Id=user;Password=pass;"
);

Oracle Extensions

Configuração Inicial
using RetailSolutions.Shared.Database.Extensions;

OracleExtension.ConfigureOracleStartup();

Configurações aplicadas:

  • Statement Cache Size: 25
  • Bind By Name: true
  • Command Timeout: 300 segundos
  • Fetch Size: 1MB
  • Trace habilitado em LogFiles/
Geração de SQL Statement
using Oracle.ManagedDataAccess.Client;

var command = new OracleCommand("SELECT * FROM users WHERE id = :id");
command.Parameters.Add(":id", OracleDbType.Int32).Value = 1;

var sql = command.GetSqlStatement();
Dapper Integration
using Dapper;
using RetailSolutions.Shared.Database.Extensions;

var parameters = new DynamicParameters();
parameters.Add(":id", 1);

var query = "SELECT * FROM users WHERE id = :id";
var sql = parameters.GetDapperSqlStatement(query);

Query Extensions

Binding automático de parâmetros em queries:

using RetailSolutions.Shared.Database.Extensions;

var query = "SELECT * FROM users WHERE id = @id AND name = :name";
var parameters = new { id = 1, name = "John" };

var boundQuery = query.BindParameters(parameters);
// Resultado: SELECT * FROM users WHERE id = 1 AND name = 'John'

Suporta:

  • Parâmetros @ (SQL Server) e : (Oracle)
  • Tipos: string, DateTime, bool, numéricos
  • Escape automático de aspas simples
  • Normalização de espaços em branco

Build e Test

Build

dotnet build

Test

dotnet test

Estrutura do Projeto

database/
├── DatabaseConnectionFactory.cs    # Factory para criação de conexões
├── Extensions/
│   ├── OracleExtension.cs          # Extensões específicas Oracle
│   └── QueryExtensions.cs          # Extensões para queries
└── RetailSolutions.Shared.Database.csproj

Requisitos

  • .NET 10.0 ou superior
  • Oracle Client (para conexões Oracle)
  • SQL Server (para conexões SQL Server)

Contribuindo

Contribuições são bem-vindas! Por favor:

  1. Faça um fork do projeto
  2. Crie uma branch para sua feature (git checkout -b feature/MinhaFeature)
  3. Commit suas mudanças (git commit -m 'Adiciona MinhaFeature')
  4. Push para a branch (git push origin feature/MinhaFeature)
  5. Abra um Pull Request

Licença

Copyright © Retail Solutions. Todos os direitos reservados.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 RetailSolutions.Shared.Database:

Package Downloads
RetailSolutions.Shared.Jobs

Controle de execução de cronjobs

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.1382 184 7/6/2026
1.2.108 96 4/30/2026
1.2.72 923 12/12/2025