WeihanLi/WeihanLi.Common
About
common tools, methods, extension methods, etc... .net 常用工具类,公共方法,常用扩展方法等,基础类库
Developer ToolsWhat you can do
- AOT-Friendly Core: Low-dependency extensions, helpers, models, compression utilities, and result/paging primitives are available from WeihanLi.Core.
- Dependency Injection: Lightweight container abstractions, decorator helpers, metadata-based registrations, proxy support, and integration with Microsoft.Extensions.DependencyInjection.
- Fluent Aspects (AOP): Dynamic proxy-based interception with fluent configuration for method-level behaviors (logging, validation, caching, etc.).
- Event Infrastructure: In-memory and queue-backed EventBus, EventStore, and handler helpers to wire publish/subscribe workflows.
Measured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalWeihanLi.Common
Overview
WeihanLi.Common bundles a set of production-ready helpers, extensions, and middleware to simplify .NET application development. It covers dependency injection, AOP, eventing, logging, data access helpers, OTP utilities, templating, and more—built from real-world usage and battle-tested across services.
Packages
| Package | Description |
|---|---|
WeihanLi.Core |
AOT-compatible core extensions, helpers, models, compression primitives, and utility APIs with no package dependencies. |
WeihanLi.Common |
Full utility package built on WeihanLi.Core: dependency resolver, DI, AOP, logging, data access, configuration helpers, TOTP utilities, command executors, etc. |
WeihanLi.Common.Logging.Serilog |
Integration layer so core logging abstractions seamlessly forward to Serilog or Microsoft.Extensions.Logging. |
WeihanLi.Extensions.Hosting |
Hosting helpers for quickly wiring background services, console apps, and DI bootstrapping. |
Each package is available on NuGet and can be referenced independently.
Installation
Install the package you need using the .NET CLI or NuGet Package Manager:
dotnet add package WeihanLi.Core
# or install the full utility package
dotnet add package WeihanLi.Common
# or install the Serilog integration
dotnet add package WeihanLi.Common.Logging.Serilog
Preview builds are also published; append --version <preview> to opt in.
Quick Start
using WeihanLi.Common.Helpers;
// Generate a TOTP code with the built-in helper.
var secret = $"{ApplicationHelper.ApplicationName}_demo_secret";
var code = TotpHelper.GenerateCode(secret);
Console.WriteLine($"Generated code: {code}");
var isValid = TotpHelper.ValidateCode(secret, code);
Console.WriteLine($"Valid code: {isValid}");
See samples/DotNetCoreSample and samples/AspNetCoreSample for richer scenarios that exercise DI decorators, event buses, logging pipelines, and more.
Feature Highlights
- AOT-Friendly Core: Low-dependency extensions, helpers, models, compression utilities, and result/paging primitives are available from
WeihanLi.Core. - Dependency Injection: Lightweight container abstractions, decorator helpers, metadata-based registrations, proxy support, and integration with
Microsoft.Extensions.DependencyInjection. - Fluent Aspects (AOP): Dynamic proxy-based interception with fluent configuration for method-level behaviors (logging, validation, caching, etc.).
- Event Infrastructure: In-memory and queue-backed
EventBus,EventStore, and handler helpers to wire publish/subscribe workflows. - Logging: Abstractions with adapters for built-in logging and Serilog plus formatting helpers to ship structured events.
- Data Access Helpers: Dapper-style extensions over ADO.NET, entity mapping utilities, and SQL expression parsers to streamline data access layers.
- OTP & Security: TOTP implementation, helpers, and service abstractions to secure user flows with minimal setup.
- Templating & Text: Lightweight template engine and string utility helpers for dynamic content rendering.
- Utilities: Process executor, pipeline builder, command helpers, configuration helpers, async invokers, and more.
Documentation & Samples
- Browse the docs in
docs/index.mdand articles underdocs/articlesfor deep dives. - API references can be generated with DocFX (
docs/docfx.json). - Samples live under
samples/and demonstrate step-by-step usage patterns you can adapt.
Building & Testing
dotnet build
dotnet test
CI builds run with both Azure Pipelines (azure-pipelines.yml) and GitHub Actions (.github/workflows/default.yml), so you can rely on the same commands locally.
Set the
DISABLE_GITHUB_ACTIONS_TEST_LOGGERenvironment variable totrueif you need to opt out of the GitHub Actions test logger integration (useful for experimenting with other reporters or diagnosing runner differences).
Release Notes
Head to the merged pull requests list or the docfx ReleaseNotes for a chronological view of changes.
Explore related projects
Loading…