English | 繁體中文
Nwpie.Foundation.NetCore.SDK is a comprehensive, modular SDK built for .NET developers. It simplifies and enhances application development by providing an all-in-one solution with well-defined abstractions, robust utilities, and modularized components. Core libraries target netstandard2.1 for broad compatibility, while endpoint and test projects multi-target net8.0 and net10.0. Fully supported with unit tests.
- Multi-target .NET 8, .NET 10 & .NET 11 (preview): Endpoint and test projects target
net8.0andnet10.0. CI also validates against .NET 11 preview. Core libraries usenetstandard2.1for broad compatibility. - Modular SDK: Use what you need with a modularized structure.
- NuGet Ready: Install individual modules via NuGet for easy integration.
- Comprehensive Tests: Unit tests demonstrate usage and ensure reliability.
- Extensive Utilities: Includes tools for logging, configuration, data access, and more.
Install individual modules via NuGet:
dotnet add package Nwpie.Foundation.Abstractions
dotnet add package Nwpie.Foundation.Common
dotnet add package Nwpie.Foundation.Caching.Common
dotnet add package Nwpie.Foundation.Caching.Redis
dotnet add package Nwpie.Foundation.Auth.SDK
dotnet add package Nwpie.Foundation.Http.CommonOr search for all available packages:
dotnet nuget search Nwpie.FoundationThe SDK provides the following modules, located under the src/ directory:
| Module Name | Description |
|---|---|
| Abstractions | Contains interfaces and base classes for common functionality. |
| Auth | Handles authentication, authorization, and token management. |
| Caching | Provides caching utilities for in-memory and distributed caching. |
| Common | Includes general-purpose utilities and helper functions. |
| Configuration | Simplifies application configuration management. |
| DataAccess | Offers tools for database access and ORM integration. |
| Extensions | Provides extension methods for common .NET types. |
| Hosting | Supports application hosting and startup configurations. |
| Http | Simplifies HTTP requests, API interactions, and REST client management. |
| Location | Provides service discovery environment mapping and hosting. |
| Logging | Includes advanced logging utilities for structured logging. |
| Measurement | Offers tools for performance monitoring and metrics collection. |
| MessageQueue | Supports message queuing and event-driven architectures. |
| Notification | Handles email, SMS, and push notification services. |
| ServiceNode | Provides utilities for service discovery and node management. |
| Storage | Simplifies file and blob storage operations. |
Register local or Redis caching in your DI container:
// In-memory cache
services.AddLocalCache<ILocalCache>();
services.AddAsDefaultICache<ILocalCache>();
// Redis cache (requires Caching.Redis module)
services.AddRedisCache<IRedisCache>();Register the default JSON serializer:
services.AddDefaultSerializer<ISerializer>();A typical service Startup.cs wires up serialization, caching, and module-specific services:
public void ConfigureServices(IServiceCollection services)
{
services.AddDefaultSerializer<ISerializer>();
services.AddLocalCache<ILocalCache>();
services.AddAsDefaultICache<ILocalCache>();
// Add module-specific services
services.AddConfigServer<IConfigServer>();
}See the samples/ directory for complete working examples (MiniSite, Serverless).
Clone the repository to explore the SDK:
git clone https://github.com/osisdie/dotnet-nwpie-foundation-sdk.git
cd dotnet-nwpie-foundation-sdkModules are located in the src/ directory. For example:
src/Abstractionssrc/Auth- ... and more.
Each module is self-contained and can be used independently or as part of the complete SDK.
Unit tests demonstrate how to use each module. Tests are located under tests/UnitTest.
To run the tests:
- Navigate to the root directory.
- Use the following command:
dotnet testThis will execute all unit tests and verify the SDK's functionality.
We welcome contributions from the open-source community! See CONTRIBUTING.md for details.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have suggestions, feel free to open an issue on GitHub.