Aethel.Extensions.Application
5.2.0
See the version list below for details.
dotnet add package Aethel.Extensions.Application --version 5.2.0
NuGet\Install-Package Aethel.Extensions.Application -Version 5.2.0
<PackageReference Include="Aethel.Extensions.Application" Version="5.2.0" />
paket add Aethel.Extensions.Application --version 5.2.0
#r "nuget: Aethel.Extensions.Application, 5.2.0"
// Install Aethel.Extensions.Application as a Cake Addin #addin nuget:?package=Aethel.Extensions.Application&version=5.2.0 // Install Aethel.Extensions.Application as a Cake Tool #tool nuget:?package=Aethel.Extensions.Application&version=5.2.0
Aethel Extensions Application
Archivos de apoyo para la capa de aplicacion.
Componentes principales
Either
Estrcutura que nos permite devolver dos respuestas de una operacion. La primera es la respuesta esperada que se devolveria normalmente. La segunda opcion es un objeto de tipo Error que que define algunas propiedades basicas para comunicar la razon de fallo de la operacion. La idea detras de esta implementacion es evitar el flujo del sistema a traves de las excepciones
Uso:
public class SomeClass {
// Propiedades
// Metodos
public Either<SuccessResponse, Error> DoSomething(SomeRequest request){
// Validaciones
return new Error("5000","Something is wrong")
// Regla de negocios
return new SuccessResponse
}
}
Al implementar esta libreria ahora podemos manejar nuestra respuesta de la siguiente manera:
public IActionResult Post(SomeRequest request){
return someClass.DoSomething(request)
.Match(
success => StatusCode(200, "All good"),
fail => StatusCode(400, "Not all good")
);
}
De esta forma podemos realizar operaciones mas intuitivas y manejar de forma mas limpia y sin las cargas de las excepciones guiando nuestro codigo
Answer
La estructura de answer es la evolucion de either para permitir realizar las mismas operaciones con menos codigo. A diferencia de Either, Answer infiera y establece desde el inicio que el tipo de objeto para el fallo, sera un objeto de tipo Error, contenido dentro del ensamblado, asi con esto, solo tenemos que hacer lo siguiente para utilizarlo
public class SomeClass {
// Propiedades
// Metodos
public Answer<SuccessResponse> DoSomething(SomeRequest request){
// Validaciones
return new Error("5000","Something is wrong")
// Regla de negocios
return new SuccessResponse
}
}
Con esto, nuestro codigo se ve mas compacto y seguimmos siendo explicitos pues siemmpre regresaremos un error. Para consumirlo desde el llamador, seguimmos haciendo lo mismo
public IActionResult Post(SomeRequest request){
return someClass.DoSomething(request)
.Match(
success => StatusCode(200, "All good"),
fail => StatusCode(400, "Not all good")
);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- MediatR (>= 10.0.1)
- Microsoft.Extensions.Caching.Memory (>= 6.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Aethel.Extensions.Application:
Package | Downloads |
---|---|
Aethel.Services.Kairos
Easy mechanism for reactive system |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.3.0 | 516 | 5/2/2022 |
5.2.0 | 2,140 | 4/29/2022 |
5.1.0 | 500 | 4/28/2022 |
5.0.0 | 539 | 4/26/2022 |
4.1.0 | 429 | 4/14/2022 |
4.0.0 | 415 | 4/14/2022 |
3.0.0 | 410 | 4/14/2022 |
2.3.1 | 446 | 4/12/2022 |
2.3.0 | 438 | 4/12/2022 |
2.2.0 | 438 | 4/12/2022 |
2.1.0 | 427 | 4/9/2022 |
2.0.0 | 426 | 4/9/2022 |
1.2.1 | 438 | 4/9/2022 |
1.2.0 | 431 | 4/9/2022 |
1.1.0 | 473 | 4/2/2022 |
1.0.1 | 462 | 3/10/2022 |
1.0.0 | 431 | 3/10/2022 |
Removiendo la interface de publisher y consumer