PowNet 2025.10.12.22

dotnet add package PowNet --version 2025.10.12.22
                    
NuGet\Install-Package PowNet -Version 2025.10.12.22
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PowNet" Version="2025.10.12.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PowNet" Version="2025.10.12.22" />
                    
Directory.Packages.props
<PackageReference Include="PowNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PowNet --version 2025.10.12.22
                    
#r "nuget: PowNet, 2025.10.12.22"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PowNet@2025.10.12.22
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PowNet&version=2025.10.12.22
                    
Install as a Cake Addin
#tool nuget:?package=PowNet&version=2025.10.12.22
                    
Install as a Cake Tool

PowNet

Modern, modular utilities & extension framework for .NET 10 � performance-aware, test-backed, extensible.

<div align="center">

Build Status Tests License Target

</div>


Quick Navigation


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 OverviewDesignUsage


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:


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

  1. Fork & branch (feat/<name> or fix/<issue>).
  2. Add/adjust tests (no feature merged without coverage).
  3. Follow existing naming & folder patterns.
  4. Run: dotnet format (if configured) & dotnet test.
  5. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed