PowNet 2025.10.12.22
dotnet add package PowNet --version 2025.10.12.22
NuGet\Install-Package PowNet -Version 2025.10.12.22
<PackageReference Include="PowNet" Version="2025.10.12.22" />
<PackageVersion Include="PowNet" Version="2025.10.12.22" />
<PackageReference Include="PowNet" />
paket add PowNet --version 2025.10.12.22
#r "nuget: PowNet, 2025.10.12.22"
#:package PowNet@2025.10.12.22
#addin nuget:?package=PowNet&version=2025.10.12.22
#tool nuget:?package=PowNet&version=2025.10.12.22
PowNet
Modern, modular utilities & extension framework for .NET 10 � performance-aware, test-backed, extensible.
<div align="center">
</div>
Quick Navigation
- Overview
- Key Features
- Why PowNet?
- Installation
- Getting Started
- Data Layer (DbIO)
- Performance & Diagnostics
- Architecture
- Examples
- Documentation Index
- Roadmap
- Contributing
- License
Overview
PowNet is a lightweight yet comprehensive extension & utility toolkit for building high-quality .NET backends, tools, services and test harnesses. It focuses on:
- Developer ergonomics
- Observability (diagnostics, profiling hooks, performance measurement)
- Configuration clarity
- Safe, explicit patterns (logging, retries, structured exceptions)
All modules are covered by unit tests (currently 395 passing tests).
Key Features
| Area | Highlights | Notes |
|---|---|---|
| Collections | Batch ops, safe parallel processing, partitioning, transformation helpers | CollectionExtensions, ListExtensions |
| Configuration | Hierarchical resolution chain, runtime overrides, backups, environment awareness | PowNetConfiguration |
| Security | Hashing helpers, crypto utils, middleware-friendly patterns | SecurityExtensions, AdvancedSecurityTools |
| Diagnostics | Performance timers, profiling wrappers, code quality + allocation analysis | DevelopmentExtensions |
| Eventing | In-process event bus with retry, filtering, pipelines, debouncing, aggregation | EventBusExtensions |
| Data Access | Abstract DbIO facade + SQL Server provider (DbIOMsSql), execution hooks, transactions |
See docs below |
| Caching | Simple primitives & cache orchestration patterns | CacheExtensions |
| Code Generation | Extension method, model, configuration & benchmark scaffolding | DevelopmentTools |
| Exceptions | Rich contextual exception builder (PowNetException) |
Structured metadata |
| JSON / Text | High-performance helpers for JSON merge, clone, diff | JsonExtensions |
| Date/Time | UTC safety, range, window & schedule utils | DateTimeExtensions |
Why PowNet?
- Avoid boilerplate: Unified wrappers for data, events, diagnostics.
- Observability built-in: hooks for logging & metrics (no hard dependency on a single logging framework).
- Production-ready defaults with development affordances.
- Explicit, documented patterns (architecture + usage docs per feature).
- Framework-agnostic: use in console apps, services, tests, microservices.
Installation
Currently consumed via project reference (monorepo style):
git clone https://github.com/mirshahreza/PowNet.git
cd PowNet
# build
dotnet build
# run tests
dotnet test
(Optional) Create a NuGet package:
dotnet pack PowNet/PowNet.csproj -c Release
Add reference in your solution:
dotnet add <YourProject>.csproj reference PowNet/PowNet.csproj
Getting Started
using PowNet.Extensions;
// Collection helper
var items = new[] {1,2,3,4};
var batched = items.Batch(2); // [[1,2],[3,4]]
// Event bus quick usage
public record UserCreated(int Id);
EventBusExtensions.Subscribe<UserCreated>((e, ct) => { Console.WriteLine($"User {e.Id}"); return Task.CompletedTask; });
await new UserCreated(10).PublishAsync();
// Configuration access
int timeout = PowNetConfiguration.GetConfigValue("PowNet:Database:CommandTimeout", 30);
Data Layer (Db IO)
DbIO abstracts ADO.NET interaction:
- Execution wrappers (sync & async) with timing + exception enrichment
- Transaction helpers (
BeginTransaction,CommitTransaction,RollbackTransaction) - Extensible provider model (add PostgreSQL/MySQL by subclassing
DbIO) - Hooks:
OnBeforeExecute,OnAfterExecute
Example:
using var db = DbIO.Instance("DefaultConnection");
var userCount = (int)(db.ExecuteScalar("SELECT COUNT(1) FROM Users") ?? 0);
More: DbIO Overview � Design � Usage
Performance & Diagnostics
The DevelopmentExtensions module provides:
- Method performance sampling (
AnalyzeMethodPerformance) - Allocation analysis (
AnalyzeMemoryAllocations) - Code quality and smell detection (
AnalyzeCodeQuality) - Benchmark + comparison utilities (
CompareMethodImplementations,CompareBenchmarks)
Example:
Func<int> add = () => 1+1;
var perf = add.AnalyzeMethodPerformance(iterations: 100);
if (!perf.IsAnalysisSkipped) Console.WriteLine(perf.AverageExecutionTime);
Architecture
PowNet
|- Configuration (PowNetConfiguration, EnvironmentManager)
|- Extensions
| |- Collections & Concurrency
| |- Diagnostics & Development
| |- EventBus (retry, pipeline, debounce)
| |- Security & Encryption
| |- Data (DbIO + provider)
| |- JSON / Text / Date / Object
|- Data (Providers, Abstract Facade)
|- Logging (PowNetLogger integration points)
|- Tests (395 validated scenarios)
Design documents: see Documentation/INDEX.
Examples
| Scenario | Snippet |
|---|---|
| Retry publish | await evt.PublishWithRetryAsync(maxRetries:3) |
| Schedule event | evt.ScheduleEvent(DateTime.UtcNow.AddSeconds(30)); |
| Transaction | db.BeginTransaction(); ... db.CommitTransaction(); |
| Generate test data | DevelopmentExtensions.GenerateTestData<MyType>(100); |
| Code smell scan | DevelopmentExtensions.DetectCodeSmells(typeof(MyType)); |
| Profile method | var r = (() => Calc()).ProfileMethod(); |
Documentation
Central docs live in the Documentation/ folder (each feature isolated). Start here:
- Full Index
- Popular entries:
Roadmap
| Status | Item |
|---|---|
| Planned | Additional DB providers (PostgreSQL, MySQL) |
| Planned | IDbIO interface + DI adapters |
| Planned | Retry / circuit breaker integration (Polly) |
| In Progress | Source generator for POCO mapping from DbDataReader |
| Planned | Bulk operations (SqlBulkCopy wrapper) |
| Planned | Metrics enrichment (row counts, latency histograms) |
Feel free to open issues for proposals.
Contributing
- Fork & branch (
feat/<name>orfix/<issue>). - Add/adjust tests (no feature merged without coverage).
- Follow existing naming & folder patterns.
- Run:
dotnet format(if configured) &dotnet test. - Submit PR with concise description + motivation.
Development Guidelines
- Keep extension methods focused & side-effect free.
- Prefer explicit configuration keys (
PowNet:Section:Key). - Avoid static mutable state unless guarded (see EventBus reset).
- Add design notes for complex subsystems (
Documentation/*.md).
License
MIT � see LICENSE.
Generated & curated; contributions to improve clarity or performance patterns are welcome.
| 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
- JWT (>= 11.0.0)
- Microsoft.AspNetCore.Http (>= 2.3.0)
- Microsoft.AspNetCore.Routing (>= 2.3.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.Caching.Memory (>= 9.0.9)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
- SixLabors.ImageSharp (>= 3.1.11)
- System.IdentityModel.Tokens.Jwt (>= 8.14.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2025.10.12.22 | 139 | 10/12/2025 |
| 2025.10.11.21 | 136 | 10/11/2025 |
| 2025.10.7.20 | 194 | 10/7/2025 |
| 2025.10.7.19 | 205 | 10/7/2025 |
| 2025.10.5.18 | 182 | 10/5/2025 |
| 2025.10.5.17 | 184 | 10/5/2025 |
| 2025.10.5.16 | 187 | 10/5/2025 |
| 2025.10.5.15 | 176 | 10/5/2025 |
| 2025.10.5.14 | 183 | 10/5/2025 |
| 2025.10.5.13 | 184 | 10/5/2025 |
| 2025.10.5.12 | 174 | 10/5/2025 |
| 2025.10.5.11 | 185 | 10/5/2025 |
| 2025.10.5.10 | 194 | 10/5/2025 |
| 2025.10.4.9 | 184 | 10/4/2025 |
| 2025.10.4.8 | 178 | 10/4/2025 |
| 2025.10.4.7 | 190 | 10/4/2025 |
| 2025.10.4.6 | 187 | 10/4/2025 |
| 2025.10.4.5 | 121 | 10/4/2025 |