Skip to content

Latest commit

 

History

History
146 lines (106 loc) · 5.95 KB

File metadata and controls

146 lines (106 loc) · 5.95 KB

Nwpie.Foundation.NetCore.SDK

.NET License Build GitHub stars GitHub issues Last commit

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.

Table of Contents


Features

  • Multi-target .NET 8 & .NET 10: Endpoint and test projects target both net8.0 and net10.0. Core libraries use netstandard2.1 for broad compatibility.
  • Modular SDK: Use what you need with a modularized structure.
  • Comprehensive Tests: Unit tests demonstrate usage and ensure reliability.
  • Extensive Utilities: Includes tools for logging, configuration, data access, and more.

Modules Overview

The 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.

Quick Start

Caching

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>();

Serialization

Register the default JSON serializer:

services.AddDefaultSerializer<ISerializer>();

Service Startup

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).


Getting Started

Clone the Repository

Clone the repository to explore the SDK:

git clone https://github.com/osisdie/Nwpie.Foundation.NetCore.SDK.git
cd Nwpie.Foundation.NetCore.SDK

Explore Modules

Modules are located in the src/ directory. For example:

  • src/Abstractions
  • src/Auth
  • ... and more.

Each module is self-contained and can be used independently or as part of the complete SDK.

Run Unit Tests

Unit tests demonstrate how to use each module. Tests are located under test/UnitTest.

To run the tests:

  1. Navigate to the root directory.
  2. Use the following command:
dotnet test

This will execute all unit tests and verify the SDK's functionality.


Contributing

We welcome contributions from the open-source community! See CONTRIBUTING.md for details.


License

This project is licensed under the BSD-3-Clause License. See the LICENSE file for details.


Support

If you encounter any issues or have suggestions, feel free to open an issue on GitHub.