ImanSoftware.DataAccess
1.0.0
dotnet add package ImanSoftware.DataAccess --version 1.0.0
NuGet\Install-Package ImanSoftware.DataAccess -Version 1.0.0
<PackageReference Include="ImanSoftware.DataAccess" Version="1.0.0" />
<PackageVersion Include="ImanSoftware.DataAccess" Version="1.0.0" />
<PackageReference Include="ImanSoftware.DataAccess" />
paket add ImanSoftware.DataAccess --version 1.0.0
#r "nuget: ImanSoftware.DataAccess, 1.0.0"
#:package ImanSoftware.DataAccess@1.0.0
#addin nuget:?package=ImanSoftware.DataAccess&version=1.0.0
#tool nuget:?package=ImanSoftware.DataAccess&version=1.0.0
ImanSoftware.DataAccess
Version: 1.0.0 | Last Updated: August 2026
A lightweight and extensible data access abstraction for .NET with support for parameterized queries, stored procedures, transactions, and
Outcome-based results.
ImanSoftware.DataAccess provides a clean abstraction over SQL data access, allowing applications to execute queries and manage transactions without being tightly coupled to a specific implementation. All operations return Outcome objects, enabling consistent error handling without relying on exceptions for expected failures.
Installation
Install the package using the .NET CLI:
dotnet add package ImanSoftware.DataAccess
Why ImanSoftware.DataAccess?
Writing data access code often leads to repetitive connection management, transaction handling, and exception handling.
This package centralizes those concerns behind a simple abstraction while integrating seamlessly with ImanSoftware.Outcome for explicit success and failure handling.
Benefits include:
- Clean Architecture friendly
- Dependency Injection compatible
- Transaction support
- Parameterized SQL execution
- Stored Procedure support
- Consistent
Outcome-based error handling
Features
- ✅
ISqlDataAccessor - ✅
IDbConnectionFactory - ✅
ITransactionScope - ✅ Async API
- ✅ Parameterized queries
- ✅ Stored Procedure support
- ✅ Ad-hoc SQL support
- ✅ Transaction management
- ✅
Outcome-based results - ✅ Dependency Injection support
ISqlDataAccessor
The primary abstraction for executing SQL commands.
Available methods:
QuerySingleAsync<T>()QueryAsync<T>()ExecuteAsync()ExecuteScalarAsync<T>()BeginTransactionAsync()
Example:
var result = await _db.QuerySingleAsync<Product>(
"GetProductById",
new { Id = id },
CommandType.StoredProcedure);
All methods return Outcome objects, allowing failures to be handled explicitly.
IDbConnectionFactory
Responsible for creating database connections.
This abstraction keeps your application independent from any specific database provider and centralizes connection creation.
ITransactionScope
Provides an abstraction for database transactions.
Available methods:
CommitAsync()RollbackAsync()
Example:
await using var transaction =
await _db.BeginTransactionAsync();
await _db.ExecuteAsync(...);
await transaction.CommitAsync();
If an error occurs:
await transaction.RollbackAsync();
Stored Procedures
Execute stored procedures easily.
await _db.QuerySingleAsync<Product>(
"GetProductById",
new
{
Id = id
},
CommandType.StoredProcedure);
Ad-hoc SQL Queries
Parameterized SQL queries are also supported.
await _db.QueryAsync<Product>(
@"SELECT *
FROM Products
WHERE CategoryId = @CategoryId",
new
{
CategoryId = categoryId
});
Outcome-Based Results
Every database operation returns an Outcome.
Example:
var result = await _db.QuerySingleAsync<Product>(...);
if (result.IsSuccess)
{
Product product = result.Value;
}
else
{
Console.WriteLine(result.Error.Message);
}
This provides predictable error handling without relying on exceptions for expected scenarios.
Dependency Injection
Register the data access services:
services.AddDataAccess(connectionString);
After registration, ISqlDataAccessor can be injected anywhere in your application.
Example
using ImanSoftware.DataAccess;
public class ProductService
{
private readonly ISqlDataAccessor _db;
public ProductService(ISqlDataAccessor db)
{
_db = db;
}
public async Task<Outcome<Product>> GetProductAsync(int id)
{
return await _db.QuerySingleAsync<Product>(
"GetProductById",
new
{
Id = id
},
CommandType.StoredProcedure);
}
}
Transaction Example
await using var transaction =
await _db.BeginTransactionAsync();
await _db.ExecuteAsync(...);
await _db.ExecuteAsync(...);
await transaction.CommitAsync();
Design Goals
- Clean abstraction
- Async-first API
- Dependency Injection friendly
- Transaction support
- Provider independent
- Lightweight
- High performance
- Outcome-based error handling
- Clean Architecture compatible
Requirements
- .NET Standard 2.0+
- .NET 6+
- .NET 7+
- .NET 8+
- .NET 9+
- .NET 10.0+
Dependencies
- ImanSoftware.Outcome
Author
Iman Estiri
📧 contact.imanestiri@gmail.com
📧 dev.imanestiri@gmail.com
GitHub:
License
This project is licensed under the MIT License.
| 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
- ImanSoftware.Outcome (>= 1.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ImanSoftware.DataAccess:
| Package | Downloads |
|---|---|
|
ImanSoftware.DataAccess.Dapper
Dapper implementation of ImanSoftware.DataAccess for high-performance SQL operations. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 162 | 8/3/2026 |