Initium 0.1.15
See the version list below for details.
dotnet add package Initium --version 0.1.15
NuGet\Install-Package Initium -Version 0.1.15
<PackageReference Include="Initium" Version="0.1.15" />
paket add Initium --version 0.1.15
#r "nuget: Initium, 0.1.15"
// Install Initium as a Cake Addin #addin nuget:?package=Initium&version=0.1.15 // Install Initium as a Cake Tool #tool nuget:?package=Initium&version=0.1.15
Initium — Service Core Foundation
Introduction
Initium is a library for simplifying .NET API development, offering standardized service operations, flexible routing, and seamless chaining of service results for cleaner and more maintainable code.
- Streamlined API Controllers: Simplifies response handling with attributes like
[ApiResponse]
, providing clear and consistent HTTP status documentation. - Centralized Result Management:
ServiceResult
enables clear success or failure status, making error handling and conditional logic seamless. - Exception Handling Made Easy:
ApiException
provides a straightforward way to handle specific HTTP error codes, improving code clarity. - Result Chaining: Methods return
ServiceResult
or typed results, allowing for intuitive chaining and cleaner service logic. - Enhanced Maintainability: Standardized patterns reduce boilerplate code, making APIs easier to build, understand, and maintain.
Getting Started
To get started with Initium, just add the package using NuGet:
dotnet add package Initium
How it Works?
Here's how to create a controller :
public class CoffeeController(CoffeeService service) : ApiController
{
[HttpPost]
[ApiResponse(200, "Coffee prepared successfully.")]
[ApiResponse(400, "An error occurred during the preparation process.")]
public ActionResult PrepareCoffee() => service.PrepareCoffee();
}
And here's how to create an action in a service, each function returns a ServiceResult
, and can be chained.
public class CoffeeService
{
public ServiceResult DoSomething()
{
return ServiceResult.Error("Something happened!", HttpStatusCode.Conflict);
}
public ServiceResult PrepareCoffee()
{
var doSomethingResult = DoSomething();
if (doSomethingResult == false) return doSomethingResult;
return ServiceResult.Ok("The coffee is now DONE!");
}
}
Contribute to Initium
See CONTRIBUTING.md for best practices and instructions on setting up your development environment to work on Initium.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- FluentValidation (>= 11.11.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Tapper.Attributes (>= 1.13.1)
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 |
---|---|---|
0.1.17 | 42 | 12/19/2024 |
0.1.16 | 41 | 12/19/2024 |
0.1.15 | 40 | 12/19/2024 |
0.1.14 | 42 | 12/18/2024 |
0.1.13 | 39 | 12/18/2024 |
0.1.12 | 44 | 12/18/2024 |
0.1.11 | 105 | 12/12/2024 |
0.1.10 | 88 | 12/11/2024 |
0.1.9 | 82 | 12/11/2024 |
0.1.8 | 84 | 12/10/2024 |
0.1.7 | 79 | 12/9/2024 |
0.1.6 | 82 | 12/9/2024 |
0.1.5 | 83 | 12/9/2024 |
0.1.4 | 78 | 12/8/2024 |