Siemens.AspNet.Lambda.Sdk.Contracts 0.1.0-alpha.306

Prefix Reserved
This is a prerelease version of Siemens.AspNet.Lambda.Sdk.Contracts.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Siemens.AspNet.Lambda.Sdk.Contracts --version 0.1.0-alpha.306
                    
NuGet\Install-Package Siemens.AspNet.Lambda.Sdk.Contracts -Version 0.1.0-alpha.306
                    
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="Siemens.AspNet.Lambda.Sdk.Contracts" Version="0.1.0-alpha.306" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Siemens.AspNet.Lambda.Sdk.Contracts" Version="0.1.0-alpha.306" />
                    
Directory.Packages.props
<PackageReference Include="Siemens.AspNet.Lambda.Sdk.Contracts" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Siemens.AspNet.Lambda.Sdk.Contracts --version 0.1.0-alpha.306
                    
#r "nuget: Siemens.AspNet.Lambda.Sdk.Contracts, 0.1.0-alpha.306"
                    
#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.
#:package Siemens.AspNet.Lambda.Sdk.Contracts@0.1.0-alpha.306
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Siemens.AspNet.Lambda.Sdk.Contracts&version=0.1.0-alpha.306&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Siemens.AspNet.Lambda.Sdk.Contracts&version=0.1.0-alpha.306&prerelease
                    
Install as a Cake Tool

Siemens.AspNet.Lambda.Sdk.Contracts

The Siemens.AspNet.Lambda.Sdk.Contracts NuGet package provides core abstractions—interfaces, delegates, and base classes—essential for implementing AWS Lambda functions using the Siemens Lambda SDK. This contract library enables consistent, maintainable, and testable Lambda implementations.


📖 Overview

This package defines interfaces and delegates crucial for middleware-based pipeline handling and function execution in AWS Lambda environments.

✅ Key Abstractions

  • 📐 Lambda Function Handlers

    • IFunctionHandler<TRequest>
    • IFunctionHandler<TRequest, TResponse>
  • 🔗 Middleware Interfaces

    • ILambdaMiddleware<TRequest>
    • ILambdaMiddleware<TRequest, TResponse>
  • 🚦 Pipeline Executors

    • ILambdaPipelineExecutor<TRequest>
    • ILambdaPipelineExecutor<TRequest, TResponse>
  • 🔀 Delegates for Request Handling

    • LambdaRequestDelegate<TRequest>
    • LambdaRequestDelegate<TRequest, TResponse>
  • 📌 Structured Error Logging

    • SpecificErrorLogHandler

📦 Installation

Using the .NET CLI

dotnet add package Siemens.AspNet.Lambda.Sdk.Contracts

🚀 Example Implementations

Implementing a simple Lambda function without response

public class MyFunction : FunctionBase<SQSEvent>
{
    public override Task HandleAsync(SQSEvent request, ILambdaContext context)
    {
        // Your Lambda handling logic here      
    }
}

Implementing a simple Lambda function with request and response

public class Function : FunctionBase<CognitoPostConfirmationEvent, CognitoPostConfirmationEvent>
{
    public override Task<CognitoPostConfirmationEvent> HandleAsync(CognitoPostConfirmationEvent request,
                                                                   ILambdaContext context)
    {
        // Your Lambda handling logic here        
    }
}

Implementing a Lambda function with custom handler and dependency injection

Function:

public class Function : FunctionHandlerBase<Startup, CognitoPostConfirmationEvent, CognitoPostConfirmationEvent>
{
}

Startup:

public sealed class Startup : LambdaStartup
{
    protected override void ConfigureServices(IServiceCollection services,
                                              IConfiguration configuration)
    {
        base.ConfigureServices(services, configuration);

        services.AddFunctionHandler();
    }
}

FunctionHandler:

internal static class AddFunctionHandlerExtension
{
    internal static void AddFunctionHandler(this IServiceCollection services)
    {
        services.AddSingletonIfNotExists<IFunctionHandler<CognitoPostConfirmationEvent, CognitoPostConfirmationEvent>, FunctionHandler>();
    }
}

internal sealed class FunctionHandler(IMyService service,
                                      IJsonSerializer jsonSerializer) : IFunctionHandler<CognitoPostConfirmationEvent, CognitoPostConfirmationEvent>
{
    public Task<CognitoPostConfirmationEvent> HandleAsync(CognitoPostConfirmationEvent request,
                                                          ILambdaContext context)
    {
        // Your custom logic here
    }
}

Lambda Middleware Pipeline

Leverage middleware for clean and maintainable request handling. Sample middleware for error logging: (This middleware is already included in the SDK and active !)

internal static class AddErrorLogRequestMiddlewareExtension
{
    internal static void AddErrorLogRequestMiddleware(this IServiceCollection services)
    {
        services.AddErrorLoggingStrategyForLambda();
            
        services.AddSingleton(typeof(ILambdaMiddleware<>), typeof(ErrorLogRequestMiddleware<>));
    }
}

internal sealed class ErrorLogRequestMiddleware<TRequest>(IErrorLoggingStrategyForLambda errorLoggingStrategy) : ILambdaMiddleware<TRequest>
{
    public async Task InvokeAsync(TRequest request,
                                    ILambdaContext context,
                                    LambdaRequestDelegate<TRequest> requestDelegate)
    {
        try
        {
            await requestDelegate(request, context).ConfigureAwait(false);
        }
        catch (Exception e)
        {
            await errorLoggingStrategy.HandleAsync(context, e).ConfigureAwait(false);
            throw;
        }
    }
}

📌 Usage & Best Practices

  • Use provided interfaces to structure Lambda functions clearly.
  • Middleware helps implement cross-cutting concerns (logging, validation, error handling).
  • Implement custom pipeline executors for advanced control over middleware execution flow.

📚 Documentation

Detailed documentation and examples are included in the source repository and will be published online soon.


📢 Contributing

Contributions and feedback are highly appreciated! Feel free to create issues or submit pull requests.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Siemens.AspNet.Lambda.Sdk.Contracts:

Package Downloads
Siemens.AspNet.Lambda.Sdk

The Siemens.AspNet.Lambda.Sdk NuGet package simplifies and accelerates the development of AWS Lambda functions using ASP.NET-inspired middleware pipelines, structured exception handling, and pre-configured startup patterns.

Siemens.AspNet.Lambda.MsTest.Sdk

Provides testing utilities and extensions for AWS Lambda functions, including structured test handlers, mock support, and coverage helpers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.332 1,315 11/11/2025
0.1.0-alpha.331 189 11/10/2025
0.1.0-alpha.330 337 11/7/2025
0.1.0-alpha.329 114 11/7/2025
0.1.0-alpha.328 104 11/7/2025
0.1.0-alpha.327 151 11/6/2025
0.1.0-alpha.326 139 11/6/2025
0.1.0-alpha.314 131 11/4/2025
0.1.0-alpha.313 135 11/4/2025
0.1.0-alpha.311 134 11/3/2025
0.1.0-alpha.309 777 10/31/2025
0.1.0-alpha.307 106 10/31/2025
0.1.0-alpha.306 115 10/31/2025
0.1.0-alpha.305 297 10/27/2025
0.1.0-alpha.303 465 10/22/2025
0.1.0-alpha.302 123 10/21/2025
0.1.0-alpha.301 114 10/21/2025
0.1.0-alpha.300 190 10/20/2025
0.1.0-alpha.299 85 10/18/2025
0.1.0-alpha.298 62 10/18/2025
0.1.0-alpha.297 63 10/18/2025
0.1.0-alpha.296 60 10/18/2025
0.1.0-alpha.294 87 10/17/2025
0.1.0-alpha.293 225 10/8/2025
0.1.0-alpha.292 119 10/8/2025
0.1.0-alpha.290 130 10/8/2025
0.1.0-alpha.289 124 10/7/2025
0.1.0-alpha.284 132 10/7/2025
0.1.0-alpha.283 259 9/19/2025
0.1.0-alpha.282 664 9/19/2025
0.1.0-alpha.281 315 9/16/2025
0.1.0-alpha.280 257 9/16/2025
0.1.0-alpha.279 256 9/16/2025
0.1.0-alpha.278 259 9/16/2025
0.1.0-alpha.275 1,032 9/3/2025
0.1.0-alpha.274 337 9/2/2025
0.1.0-alpha.273 1,258 9/1/2025
0.1.0-alpha.272 123 9/1/2025
0.1.0-alpha.271 175 8/29/2025
0.1.0-alpha.270 160 8/29/2025
0.1.0-alpha.269 161 8/29/2025
0.1.0-alpha.268 164 8/29/2025
0.1.0-alpha.267 172 8/27/2025
0.1.0-alpha.266 167 8/27/2025
0.1.0-alpha.264 264 8/22/2025
0.1.0-alpha.263 72 8/22/2025
0.1.0-alpha.262 75 8/22/2025
0.1.0-alpha.261 93 8/22/2025
0.1.0-alpha.260 98 8/22/2025
0.1.0-alpha.259 100 8/22/2025
0.1.0-alpha.258 199 8/19/2025
0.1.0-alpha.257 198 8/18/2025
0.1.0-alpha.246 160 8/14/2025
0.1.0-alpha.245 127 8/14/2025
0.1.0-alpha.244 149 8/14/2025
0.1.0-alpha.243 128 8/14/2025
0.1.0-alpha.238 130 8/12/2025
0.1.0-alpha.237 481 8/6/2025
0.1.0-alpha.236 240 8/5/2025
0.1.0-alpha.235 207 8/5/2025
0.1.0-alpha.234 235 8/5/2025
0.1.0-alpha.233 169 8/4/2025
0.1.0-alpha.232 184 8/4/2025
0.1.0-alpha.231 76 8/1/2025
0.1.0-alpha.230 79 8/1/2025
0.1.0-alpha.229 98 7/31/2025
0.1.0-alpha.228 100 7/31/2025
0.1.0-alpha.227 102 7/31/2025
0.1.0-alpha.225 99 7/31/2025
0.1.0-alpha.224 104 7/30/2025
0.1.0-alpha.222 320 7/16/2025
0.1.0-alpha.219 175 7/14/2025
0.1.0-alpha.217 93 7/11/2025
0.1.0-alpha.212 168 7/8/2025
0.1.0-alpha.211 135 7/3/2025
0.1.0-alpha.207 122 7/3/2025
0.1.0-alpha.206 264 6/30/2025
0.1.0-alpha.205 123 6/27/2025
0.1.0-alpha.202 97 6/27/2025
0.1.0-alpha.200 104 6/27/2025
0.1.0-alpha.198 104 6/27/2025
0.1.0-alpha.196 111 6/27/2025
0.1.0-alpha.195 100 6/27/2025
0.1.0-alpha.194 107 6/27/2025
0.1.0-alpha.193 107 6/27/2025
0.1.0-alpha.192 105 6/27/2025
0.1.0-alpha.191 105 6/27/2025
0.1.0-alpha.189 124 6/26/2025
0.1.0-alpha.188 121 6/26/2025
0.1.0-alpha.187 121 6/26/2025
0.1.0-alpha.186 123 6/26/2025
0.1.0-alpha.185 145 6/26/2025
0.1.0-alpha.184 117 6/26/2025
0.1.0-alpha.183 123 6/26/2025
0.1.0-alpha.182 123 6/26/2025
0.1.0-alpha.181 123 6/25/2025
0.1.0-alpha.180 133 6/24/2025
0.1.0-alpha.179 145 6/23/2025
0.1.0-alpha.178 150 6/23/2025
0.1.0-alpha.176 128 6/23/2025
0.1.0-alpha.174 147 6/19/2025
0.1.0-alpha.173 128 6/19/2025
0.1.0-alpha.172 147 6/17/2025
0.1.0-alpha.171 148 6/16/2025
0.1.0-alpha.169 128 6/16/2025
0.1.0-alpha.165 282 6/13/2025
0.1.0-alpha.164 235 6/13/2025
0.1.0-alpha.163 238 6/13/2025
0.1.0-alpha.160 273 6/12/2025
0.1.0-alpha.159 308 6/11/2025
0.1.0-alpha.158 276 6/11/2025
0.1.0-alpha.143 306 6/11/2025
0.1.0-alpha.142 295 6/11/2025
0.1.0-alpha.140 298 6/11/2025
0.1.0-alpha.139 277 6/10/2025
0.1.0-alpha.138 258 6/9/2025
0.1.0-alpha.137 57 6/7/2025
0.1.0-alpha.136 59 6/7/2025
0.1.0-alpha.135 111 6/6/2025
0.1.0-alpha.134 105 6/6/2025
0.1.0-alpha.130 131 6/5/2025
0.1.0-alpha.129 147 6/4/2025
0.1.0-alpha.128 127 6/4/2025
0.1.0-alpha.122 148 6/3/2025
0.1.0-alpha.121 159 6/1/2025
0.1.0-alpha.120 103 6/1/2025
0.1.0-alpha.118 155 5/28/2025
0.1.0-alpha.117 130 5/28/2025
0.1.0-alpha.116 132 5/28/2025
0.1.0-alpha.115 142 5/26/2025
0.1.0-alpha.114 170 5/22/2025
0.1.0-alpha.112 166 5/21/2025
0.1.0-alpha.111 133 5/20/2025
0.1.0-alpha.108 138 5/19/2025
0.1.0-alpha.104 220 5/18/2025
0.1.0-alpha.102 226 5/14/2025
0.1.0-alpha.101 237 5/14/2025
0.1.0-alpha.100 252 5/12/2025
0.1.0-alpha.99 234 5/12/2025
0.1.0-alpha.98 81 5/10/2025
0.1.0-alpha.97 84 5/10/2025
0.1.0-alpha.86 138 5/8/2025
0.1.0-alpha.85 146 5/8/2025
0.1.0-alpha.84 154 5/8/2025
0.1.0-alpha.82 163 5/7/2025
0.1.0-alpha.81 144 5/6/2025
0.1.0-alpha.76 93 5/3/2025
0.1.0-alpha.75 91 5/2/2025
0.1.0-alpha.74 118 5/2/2025