PolyAdo 2025.9.4
See the version list below for details.
dotnet add package PolyAdo --version 2025.9.4
NuGet\Install-Package PolyAdo -Version 2025.9.4
<PackageReference Include="PolyAdo" Version="2025.9.4" />
<PackageVersion Include="PolyAdo" Version="2025.9.4" />
<PackageReference Include="PolyAdo" />
paket add PolyAdo --version 2025.9.4
#r "nuget: PolyAdo, 2025.9.4"
#:package PolyAdo@2025.9.4
#addin nuget:?package=PolyAdo&version=2025.9.4
#tool nuget:?package=PolyAdo&version=2025.9.4
- 📦 Intro & features
- 🛠️ Installation
- 💻 Usage (basic CRUD examples)
- 🌐 Multi-database providers (SQL Server, MySQL, PostgreSQL, Oracle)
- 🔌 Dependency Injection (with two SQL Server instances demo)
- 📜 License
PolyAdo
PolyAdo is a lightweight, provider-agnostic ADO.NET abstraction layer for .NET.
It wraps SQL Server, MySQL, PostgreSQL, and Oracle databases into a unified async API.
With PolyAdo, you can:
- Perform async CRUD operations (
ExecuteScalar
,ExecuteNonQuery
,ExecuteReader
,ExecuteQuery
). - Work with multiple database providers seamlessly.
- Inject multiple instances of the same database type (e.g., two SQL Server connections) using Dependency Injection.
- Keep things lightweight — no ORM overhead.
✨ Features
- ✅ Unified interface for multiple databases
- ✅ Async operations
- ✅ Dependency Injection (multi-instance support)
- ✅ Clean error handling (
Success
,ErrorMessage
,Data
) - ✅ Extensible design for future providers (e.g., SQLite, MongoDB)
📦 Installation
Install from NuGet:
dotnet add package PolyAdo
Or via Package Manager:
Install-Package PolyAdo
🚀 Usage
Example Table
For demo purposes, assume the following SQL Server table:
CREATE TABLE PolyAdoTestResult (
[Id] INT IDENTITY PRIMARY KEY NOT NULL,
[TestName] VARCHAR(100) NOT NULL,
[Comment] VARCHAR(255),
[Timestamp] DATETIME2(0)
);
1. Basic CRUD Operations
using PolyAdo.Core;
using System.Collections.Generic;
// Define a settings class
public class SqlServerSetting : IAdoSetting
{
public string ConnectionString { get; set; }
}
// Create instance
var client = new SqlServer<SqlServerSetting>(new SqlServerSetting
{
ConnectionString = "Server=.;Database=TestDb;User Id=sa;Password=YourPassword;"
});
// INSERT
var insertResult = await client.ExecuteNonQueryAsync(
"INSERT INTO PolyAdoTestResult (TestName, Comment, Timestamp) VALUES ('InsertTest', 'Inserted successfully', GETDATE())",
new Dictionary<string, object>()
);
// READ
var readResult = await client.ExecuteQueryAsync("SELECT * FROM PolyAdoTestResult");
if ((bool)readResult["Success"])
{
var table = (System.Data.DataTable)readResult["Data"];
Console.WriteLine($"Fetched {table.Rows.Count} rows.");
}
// UPDATE
var updateResult = await client.ExecuteNonQueryAsync(
"UPDATE PolyAdoTestResult SET Comment='Updated via PolyAdo' WHERE TestName='InsertTest'",
new Dictionary<string, object>()
);
// DELETE
var deleteResult = await client.ExecuteNonQueryAsync(
"DELETE FROM PolyAdoTestResult WHERE TestName='InsertTest'",
new Dictionary<string, object>()
);
2. Stored Procedure Example
CREATE PROCEDURE usp_PerformTest
@name VARCHAR(100),
@comment VARCHAR(255)
AS
BEGIN
INSERT INTO PolyAdoTestResult (TestName, Comment, Timestamp)
VALUES (@name, @comment, GETDATE());
END
var spResult = await client.ExecuteNonQueryAsync(
"usp_PerformTest",
new Dictionary<string, object>
{
{ "@name", "SPTest" },
{ "@comment", "Inserted via stored procedure" }
}
);
3. Dependency Injection (Multiple Instances)
PolyAdo supports multiple DB connections of the same type. For example, you might need two SQL Server databases in the same project.
using Microsoft.Extensions.DependencyInjection;
using PolyAdo.Core;
public class SqlServerSettingA : IAdoSetting
{
public string ConnectionString { get; set; }
}
public class SqlServerSettingB : IAdoSetting
{
public string ConnectionString { get; set; }
}
var services = new ServiceCollection();
// Register two SQL Server instances
services.AddSingleton<IAdoClient<SqlServerSettingA>>(sp =>
new SqlServer<SqlServerSettingA>(new SqlServerSettingA
{
ConnectionString = "Server=.;Database=DbA;User Id=sa;Password=YourPassword;"
})
);
services.AddSingleton<IAdoClient<SqlServerSettingB>>(sp =>
new SqlServer<SqlServerSettingB>(new SqlServerSettingB
{
ConnectionString = "Server=.;Database=DbB;User Id=sa;Password=YourPassword;"
})
);
var provider = services.BuildServiceProvider();
// Resolve two instances
var dbA = provider.GetRequiredService<IAdoClient<SqlServerSettingA>>();
var dbB = provider.GetRequiredService<IAdoClient<SqlServerSettingB>>();
// Use independently
await dbA.ExecuteNonQueryAsync("INSERT INTO TableA (Col) VALUES ('From DB A')", new());
await dbB.ExecuteNonQueryAsync("INSERT INTO TableB (Col) VALUES ('From DB B')", new());
⚡ Supported Providers
- ✅ SQL Server (
Microsoft.Data.SqlClient
) - ✅ MySQL (
MySql.Data.MySqlClient
) - ✅ PostgreSQL (
Npgsql
) - ✅ Oracle (
Oracle.ManagedDataAccess
)
📜 License
MIT License — feel free to use in commercial or open-source projects.
🌟 Roadmap
- Bulk operations support
- Extended DI configuration helpers
📢 Feedback & Issues
We’d love to hear your thoughts! If you encounter any issues, have feature requests, or simply want to share feedback, please fill out our short form: https://forms.gle/ogPRAoCrAHRwWzqx5
👉 Submit Feedback & Issues
Your input helps us improve PolyAdo for everyone 🚀
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net9.0
- Microsoft.Data.SqlClient (>= 6.0.1)
- Microsoft.Extensions.Logging (>= 9.0.1)
- MySql.Data (>= 9.2.0)
- Npgsql (>= 9.0.2)
- Oracle.ManagedDataAccess.Core (>= 23.9.1)
- System.Data.SQLite.Core (>= 1.0.119)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.