OracleDbUtils 1.4.1
See the version list below for details.
dotnet add package OracleDbUtils --version 1.4.1
NuGet\Install-Package OracleDbUtils -Version 1.4.1
<PackageReference Include="OracleDbUtils" Version="1.4.1" />
<PackageVersion Include="OracleDbUtils" Version="1.4.1" />
<PackageReference Include="OracleDbUtils" />
paket add OracleDbUtils --version 1.4.1
#r "nuget: OracleDbUtils, 1.4.1"
#:package OracleDbUtils@1.4.1
#addin nuget:?package=OracleDbUtils&version=1.4.1
#tool nuget:?package=OracleDbUtils&version=1.4.1
OracleDbUtils
OracleDbUtils is a .NET utility library that simplifies working with Oracle databases using Oracle.ManagedDataAccess.Core
. It provides a clean abstraction layer for executing stored procedures, querying views/tables, and generating reports via Oracle Reports.
✨ Features
- ✅ Easy execution of Oracle PL/SQL procedures and functions
- ✅ Query tables and views with strongly-typed DTOs
- ✅ Pagination support
- ✅ Oracle Reports generation using HTTP API
- ✅ Custom attribute-based mapping system
- ✅ Built-in DI registration extensions
📦 Installation
Install via NuGet:
dotnet add package OracleDbUtils
🧩 Dependency Injection Setup
builder.Services.AddOracleDbContext();
builder.Services.AddOracleReportService();
🚀 Quick Start
1. Execute a PL/SQL Package Procedure
public class MyProcEntity : OracleEntity
{
[OracleParameter("P_ID", OracleDbType.Int32)]
public int Id { get; set; }
public override void EnsureEntity()
{
if (Id <= 0)
throw new OraException("600", "Id must be positive.");
}
}
var entity = new MyProcEntity { Id = 123 };
var result = await dbContext.ExecutePackageAsync(entity, "MY_PACKAGE.MY_PROCEDURE");
2. Query a View or Table
public class EmployeeDto : OracleBaseDto
{
[OracleField("EMP_ID", OracleDbType.Int32)]
public int Id { get; set; }
[OracleField("EMP_NAME", OracleDbType.Varchar2)]
public string Name { get; set; } = string.Empty;
}
var employees = await dbContext.SelectViewAsync<EmployeeDto>(
viewName: "EMPLOYEES_VIEW",
conditions: new Dictionary<string, object> { ["DEPT_ID"] = 10 },
orderBy: "EMP_NAME",
pagination: new OraclePaginationDto(pageNumber: 0, pageSize: 10)
);
3. Generate an Oracle Report (PDF)
var reportRequest = new OracleReportRequest
{
ReportName = "HR_REPORT.rdf",
DestName = "output/report.pdf",
Parameters = new Dictionary<string, object>
{
["P_DEPT_ID"] = 10
}
};
var reportBytes = await reportService.GenerateOracleReport(reportRequest);
File.WriteAllBytes("HR_Report.pdf", reportBytes);
🧱 Core Components
IDbContext
Interface to execute Oracle procedures and queries:
Task<T> ExecutePackageAsync<T>(T entity, string programUnitName) where T : OracleEntity;
Task<List<T>> SelectViewAsync<T>(string viewName, Dictionary<string, object> conditions, string? orderBy = null, OraclePaginationDto? pagination = null) where T : OracleBaseDto, new();
Task<T?> SelectSingleAsync<T>(string viewName, Dictionary<string, object> conditions) where T : OracleBaseDto, new();
Task<int> SelectViewCountAsync(string viewName, Dictionary<string, object> conditions);
OracleEntity
Base class for objects sent to stored procedures. Override EnsureEntity()
for validation logic.
OracleBaseDto
Base class for data transfer objects (DTOs) mapped to views/tables.
OracleFieldAttribute
Maps class properties to Oracle view/table columns:
[OracleField("COLUMN_NAME", OracleDbType.Varchar2)]
public string PropertyName { get; set; }
OracleParameterAttribute
Maps class properties to procedure parameters with direction and size control:
[OracleParameter("P_NAME", OracleDbType.Varchar2, direction: ParameterDirection.Input)]
public string Name { get; set; }
OraclePaginationDto
Enforces pagination for view queries (PageNumber ≥ 0, PageSize ∈ [0, 25]).
OracleReportRequest
Model for defining Oracle report generation requests:
new OracleReportRequest
{
ReportName = "MyReport.rdf",
DestFormat = "pdf",
Parameters = new Dictionary<string, object> { ["P_ID"] = 123 }
}
IReportService
Defines a service that returns the raw bytes of an Oracle report file.
⚠️ Pagination Rules
OraclePaginationDto
enforces:
- PageNumber ≥ 0
- PageSize ∈ [0, 25]
Violations will throw OraException
with code "602"
.
🔧 Requirements
- .NET 6.0 or later (supports .NET 8)
Oracle.ManagedDataAccess.Core
(automatically included)- Access to Oracle Database
- Optional: Oracle Reports server (HTTP-accessible)
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
💬 Feedback / Issues
Found a bug or want to request a feature?
Open an issue on GitHub
🙌 Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
👀 Example Use Cases
- Simplifying complex Oracle DB access in enterprise apps
- Wrapping PL/SQL logic behind simple service calls
- Building report export features in .NET backends
Product | Versions 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. |
-
net8.0
- ClosedXML (>= 0.105.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.7)
- Microsoft.Extensions.Http (>= 9.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.7)
- Oracle.ManagedDataAccess.Core (>= 23.9.1)
- System.ServiceModel.Http (>= 8.1.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on OracleDbUtils:
Package | Downloads |
---|---|
OracleAuthLib
Authentication and authorization library for Oracle-based systems. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.6.6 | 185 | 8/8/2025 |
1.6.5 | 43 | 8/2/2025 |
1.6.4 | 45 | 8/2/2025 |
1.6.3 | 50 | 8/2/2025 |
1.6.2 | 42 | 8/2/2025 |
1.6.1 | 40 | 8/2/2025 |
1.6.0 | 44 | 8/2/2025 |
1.5.2 | 112 | 7/30/2025 |
1.5.1 | 112 | 7/30/2025 |
1.5.0 | 113 | 7/30/2025 |
1.4.3 | 103 | 7/27/2025 |
1.4.2 | 211 | 7/26/2025 |
1.4.1 | 211 | 7/26/2025 |
1.4.0 | 212 | 7/26/2025 |
1.3.4 | 226 | 7/26/2025 |
1.3.3 | 224 | 7/26/2025 |
1.3.2 | 146 | 7/1/2025 |
1.3.1 | 137 | 7/1/2025 |
1.3.0 | 147 | 6/2/2025 |
1.2.2 | 164 | 4/29/2025 |
1.2.1 | 142 | 4/29/2025 |
1.2.0 | 147 | 4/29/2025 |
1.1.0 | 113 | 4/12/2025 |
1.0.2 | 130 | 4/11/2025 |
1.0.1 | 143 | 4/11/2025 |
1.0.0 | 128 | 4/11/2025 |