RetailSolutions.Shared.Database
1.3.1382
dotnet add package RetailSolutions.Shared.Database --version 1.3.1382
NuGet\Install-Package RetailSolutions.Shared.Database -Version 1.3.1382
<PackageReference Include="RetailSolutions.Shared.Database" Version="1.3.1382" />
<PackageVersion Include="RetailSolutions.Shared.Database" Version="1.3.1382" />
<PackageReference Include="RetailSolutions.Shared.Database" />
paket add RetailSolutions.Shared.Database --version 1.3.1382
#r "nuget: RetailSolutions.Shared.Database, 1.3.1382"
#:package RetailSolutions.Shared.Database@1.3.1382
#addin nuget:?package=RetailSolutions.Shared.Database&version=1.3.1382
#tool nuget:?package=RetailSolutions.Shared.Database&version=1.3.1382
RetailSolutions.Shared.Database
A shared .NET library providing a unified abstraction layer for Oracle and SQL Server database access, built on top of Dapper with connection factory logic and Oracle-specific performance tuning.
Features
- Connection Factory — auto-detects Oracle or SQL Server from the connection string and returns a
DbConnection - Oracle Performance Tuning — statement cache, bind-by-name, fetch size, and network buffer settings applied at startup
- SQL Statement Expansion — expands parameterized commands into readable SQL for logging and debugging
- Dapper Integration — works with
DynamicParametersviaGetDapperSqlStatement - Parameter Binding — replaces
@param/:paramplaceholders with typed literal values
Installation
dotnet add package RetailSolutions.Shared.Database
Available on NuGet.org.
Requirements
- .NET 10.0 or later
Dependencies
| Package | Version |
|---|---|
| Dapper | 2.1.66 |
| Microsoft.Data.SqlClient | 6.1.3 |
| Oracle.ManagedDataAccess.Core | 23.26.0 |
| Microsoft.Extensions.Configuration | 10.0.1 |
| Microsoft.Extensions.DependencyInjection | 10.0.1 |
| Microsoft.Extensions.Hosting | 10.0.1 |
Usage
DatabaseConnectionFactory
Automatically creates the appropriate connection based on the connection string:
using RetailSolutions.Shared.Database;
// Oracle — detected via "Data Source=" prefix
var oracleConn = DatabaseConnectionFactory.CreateDbConnection(
"Data Source=localhost:1521/XE;User Id=user;Password=pass;"
);
// SQL Server — detected via "Server=" prefix
var sqlConn = DatabaseConnectionFactory.CreateDbConnection(
"Server=localhost;Database=MyDb;User Id=user;Password=pass;"
);
Both return DbConnection, keeping the calling code database-agnostic.
Oracle Extensions
Startup Configuration
Call once at application startup to apply Oracle-wide performance settings:
using RetailSolutions.Shared.Database.Extensions;
OracleExtension.ConfigureOracleStartup();
Applied settings:
| Setting | Value |
|---|---|
| Statement Cache Size | 25 |
| Bind By Name | true |
| Command Timeout | 300 s |
| Fetch Size | 1 MB |
| Trace Directory | LogFiles/ |
| Send / Receive Buffer | 8192 bytes |
SQL Statement Expansion
Expands an OracleCommand into a human-readable SQL string with parameters inlined — useful for logging:
using Oracle.ManagedDataAccess.Client;
var cmd = new OracleCommand("SELECT * FROM users WHERE id = :id");
cmd.Parameters.Add(":id", OracleDbType.Int32).Value = 1;
string sql = cmd.GetSqlStatement();
// SELECT * FROM users WHERE id = 1
Dapper Integration
using Dapper;
using RetailSolutions.Shared.Database.Extensions;
var parameters = new DynamicParameters();
parameters.Add(":id", 1);
string sql = parameters.GetDapperSqlStatement("SELECT * FROM users WHERE id = :id");
// SELECT * FROM users WHERE id = 1
Query Extensions
Replaces @param / :param placeholders with typed literal values:
using RetailSolutions.Shared.Database.Extensions;
var query = "SELECT * FROM users WHERE id = @id AND name = :name";
var parameters = new { id = 1, name = "John" };
string bound = query.BindParameters(parameters);
// SELECT * FROM users WHERE id = 1 AND name = 'John'
Type handling:
| Type | Output |
|---|---|
string |
Single-quoted, special characters escaped |
DateTime |
'yyyy/MM/dd' |
bool |
1 / 0 |
| Numeric | Decimal separator normalized to . |
Build
dotnet build
dotnet publish # produces NuGet package
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
License
Copyright © Retail Solutions. All rights reserved.
| Product | Versions 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. |
-
net10.0
- Dapper (>= 2.1.66)
- Microsoft.Data.SqlClient (>= 6.1.3)
- Microsoft.Extensions.Configuration (>= 10.0.1)
- Microsoft.Extensions.DependencyInjection (>= 10.0.1)
- Microsoft.Extensions.Hosting (>= 10.0.1)
- Oracle.ManagedDataAccess.Core (>= 23.26.0)
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.