Pseudonym.Net.Library.Lambda.Core 1.2.2

.NET Core 2.1
There is a newer version of this package available.
See the version list below for details.
dotnet add package Pseudonym.Net.Library.Lambda.Core --version 1.2.2
NuGet\Install-Package Pseudonym.Net.Library.Lambda.Core -Version 1.2.2
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="Pseudonym.Net.Library.Lambda.Core" Version="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pseudonym.Net.Library.Lambda.Core --version 1.2.2
#r "nuget: Pseudonym.Net.Library.Lambda.Core, 1.2.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Pseudonym.Net.Library.Lambda.Core as a Cake Addin
#addin nuget:?package=Pseudonym.Net.Library.Lambda.Core&version=1.2.2

// Install Pseudonym.Net.Library.Lambda.Core as a Cake Tool
#tool nuget:?package=Pseudonym.Net.Library.Lambda.Core&version=1.2.2


This is a Library to streamline Lambda under one common operation or standard. It is geared towards those who are used to developing with .netcore and familiar with the concepts of dependency injection and component based architecture.

This library wraps Amazon.Lambda.Core and provides the following benefits:

  • The library contains the lambda raw entrypoint and self discovers an entry point you define through interfaces, making you implementation strongly typed from the beginning.
  • Scoped Dependency Injection through the use of discoverable interfaces to configure your container.
  • Wrapping of logging, ILambdaContext and other Amazon features to make them injectable.
  • Integrated Error handling to log out and return¹ any errors encountered.
  • Simple, fast and easy - one class lambda with all the mess sorted for you.

Configuring the entry point

To configure the entry point using this library, you simply need to implement the ISyncLambdaRequestProcessor interface or the IAsyncLambdaRequestProcessor interface if you're creating an async lambda².

The generic TInput can be the class model representative of the json you intend to pass to the lambda, this will be automatically detected and parsed into this type upon running. If your lambda is a sync lambda, you can also specify a TOutput generic type which will be wrapped by IlambdaReponse.

When configuring the lambda, the handler string will always be the same:

  • Sync: Pseudonym.Net.Library.Lambda.Core.Implementation::Implementation.SyncLambdaRequestProcessor::ExecuteAsync
  • Async: Pseudonym.Net.Library.Lambda.Core.Implementation::Implementation.AsyncLambdaRequestProcessor::ExecuteAsync

Note: you can only have one implementation of one of these interfaces in your solution, if not you'll receive a runtime error.

Registering Services to the Container

Once you have made your entry point, you'll need to register it to the container, along with any other services you need to. This is done by creating a class that inherits the IContainerServicesSetup interface. There, you will have access to the container, where you can register the entry point by calling container.AddSyncHandler()/container.AddAsyncHandler().

You can also register additional services as normal, as per the example below:

public class ContainerConfig : IContainerServicesSetup
    public void Configure(IServiceCollection container)
        //registering a Sync handler that takes an integer and responds with a string.
        container.AddSyncHandler<int, string, SyncHandler>();

            .AddTransient<ILambdaContext>(sp => sp.GetRequiredService<ScopedLambdaContext>().Context)
            .AddTransient<IScopedLambdaContextSetter>(sp => sp.GetRequiredService<ScopedLambdaContext>());

        container.AddTransient<ILambdaSerializer>(sp => sp.GetRequiredService<JsonSerializer>());

Available helper classes

  • You can resolve amazons ILambdaContext from anywhere in the code by injecting it into the constructor of your class, this is all made injectable behind the scenes.
  • You can resolve ILambdaResponder with a generic payload from anywhere in the code to get a wrapped helper that will build response objects for you. ** Note: If you do not want to use the standard lambdaresponse wrapper where you output is placed under the jtoken 'Data', use the .Raw() method.
  • You can resolve ILambdaSerializer from anywhere in the code to get hold of the current lambdas serializer and its settings.


¹ Footnote content goes here Will only return the error if the compiled json of the error is under 6MB as that is the restriction on lambdas.

² Note, that in terms of async and sync lambdas an Sync lambda is when you essentially have a blocking lambda that returns a result, whereas an Async Lambda just runs, and does not return a result. Both Async & Sync lambdas are run in a async context in terms of .net async from System.Threading.Tasks, please don't confuse these!

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
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
1.4.1 426 10/22/2019
1.4.0 347 10/22/2019
1.3.3 338 10/21/2019
1.3.2 361 10/21/2019
1.3.1 340 10/21/2019
1.3.0 337 10/21/2019
1.2.2 367 10/14/2019
1.2.1 480 10/14/2019
1.2.0 378 10/14/2019
1.1.2 349 10/11/2019
1.1.1 473 10/11/2019
1.1.0 480 10/11/2019
1.0.9 500 10/11/2019
1.0.8 408 10/11/2019
1.0.7 419 10/11/2019
1.0.6 398 10/11/2019
1.0.5 412 10/11/2019
1.0.4 413 10/11/2019
1.0.3 406 10/11/2019
1.0.2 405 10/11/2019
1.0.1 385 10/11/2019
1.0.0 402 10/11/2019