Genesis.LanguageExt.AspNetCore 7.0.0

dotnet add package Genesis.LanguageExt.AspNetCore --version 7.0.0                
NuGet\Install-Package Genesis.LanguageExt.AspNetCore -Version 7.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Genesis.LanguageExt.AspNetCore" Version="7.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Genesis.LanguageExt.AspNetCore --version 7.0.0                
#r "nuget: Genesis.LanguageExt.AspNetCore, 7.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Genesis.LanguageExt.AspNetCore as a Cake Addin
#addin nuget:?package=Genesis.LanguageExt.AspNetCore&version=7.0.0

// Install Genesis.LanguageExt.AspNetCore as a Cake Tool
#tool nuget:?package=Genesis.LanguageExt.AspNetCore&version=7.0.0                

Genesis Minimal Endpoints: LanguageExt

.NET CodeQL nuget license

Converts LanguageExt monads to ActionResult or minimal API IResult.

Quick Reference

  • Any monad that has a proper object will return a success code of 200 OK with a response body
  • Any monad that returns Unit will return a success code of 204 No Content
  • The Option<T> monad will either be a success of 200 or 204 and the none condition is converted to a 404 Not Found
    • Monad with nested Option<T> such as Fin<Option<T>> could return 200, 204, 404, or 500 as Fin<Option<T>> could be a success with an option of
      • Unit (204)
      • T (200)
      • None (404)
      • Error (500).
  • The Try monad will return either a 200, 204, or 500
  • The TryOption monad will return either a 200, 204, 404, or 500
  • The Eff monad will return a 200, 204, or 500
  • The Aff monad will return a 200, 204, or 500

Proper IEFT problem detail responses will be presented with the appropriate status code based on the exception that is contained within the Fin, Try, TryOption, Eff, and Aff monads.

Usage

LanguageExt monads can be converted to Action or IResult. The extensions functions can be used by importing Genesis.

Quick Start

using Genesis;
//. Other code

IResult result = Try(() => "Hello, World!").ToResult();

Minimal APIs

using static LanguageExt.Prelude;
using Genesis;

interface IService { Option<string> GetMessage(); }

class MyService : IService {
    Option<string> GetMessage() => "Hello, World!";
}

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddTransient<IService, MyService>();

var app = builder.Build();

app.MapGet("/", (IService service) => service.GetMessage().ToResult());

app.Run();
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
7.0.0 227 5/30/2023