[フレーム]
BT

InfoQ Software Architects' Newsletter

A monthly overview of things you need to know as an architect or aspiring architect.

View an example

We protect your privacy.

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Unlock the full InfoQ experience

Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources.

Log In
or

Don't have an InfoQ account?

Register
  • Stay updated on topics and peers that matter to youReceive instant alerts on the latest insights and trends.
  • Quickly access free resources for continuous learningMinibooks, videos with transcripts, and training materials.
  • Save articles and read at anytimeBookmark articles to read whenever youre ready.

Topics

Choose your language

InfoQ Homepage News AWS Introduces the .NET Annotations Lambda Framework in Preview

AWS Introduces the .NET Annotations Lambda Framework in Preview

This item in japanese

Apr 27, 2022 2 min read

Write for InfoQ

Feed your curiosity. Help 550k+ global
senior developers
each month stay ahead.
Get in touch

Recently, AWS introduced a new framework for writing .NET 6 Lambda functions called Lambda Annotations. This framework was built alongside the .NET 6 managed runtime for Lambda released last February.

Lambda Annotations is a programming model for writing .NET Lambda functions. It bridges the gap between the Lambda programming model and the more idiomatic programming model; the programming model permits idiomatic.NET coding patterns and leverages C# Source Generators.

In an AWS Developer Tools blog post, Norm Johanson, a software developer engineer at Amazon.com, explains:

The Annotations framework makes the experience of writing Lambda feel more natural in C#. It also takes care of synchronizing the Lambda functions implemented in your code with your project’s CloudFormation template. This means you don’t have to worry about function handler strings not being set correctly in CloudFormation templates or lose focus while coding to also update your CloudFormation JSON or YAML template.

Johanson also mentions that when the C# compiler is used to create the project, the Annotations framework looks for the .NET Lambda properties that indicate Lambda functions and adds extra code to the build that handles the translation. It will also sync the generated information, including a new function handler string, into the CloudFormation template. In addition, Johanson states that using the C# source generators is a way to create the translation layer at compile time that avoids reflection code at runtime.

Developers can use the new framework through the AWS Toolkit for Visual Studio 2022. With the Microsoft Integrated Development Environment (IDE), they can create a project with the available AWS Serverless Application project template - allowing them to write one or more Lambda functions and deploy them to AWS using AWS CloudFormation, along with any other required AWS resources, as a single unit of deployment.


Source: https://aws.amazon.com/blogs/developer/introducing-net-annotations-lambda-framework-preview/

Once the project is created, there is a dependency on Amazon.Lambda.Annotations NuGet package, which includes the.NET properties used to annotate Lambda code and the C# source generator that generates the produced translation code. Furthermore, the Annotations framework makes it easy to configure dependency injection for Lambda functions using the LambdaStartup attribute.

The official .NET on AWS twitter handler stated in a tweet:

Now you can replace the regular AWS Lambda program model with a simpler version and just focus on business logic.

Lastly, the development of the framework is in the aws/aws-lambda-dotnet GitHub repository.

About the Author

Steef-Jan Wiggers

Show moreShow less

Rate this Article

Adoption
Style

This content is in the Cloud topic

Related Topics:

Related Content

The InfoQ Newsletter

A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example

We protect your privacy.

BT

AltStyle によって変換されたページ (->オリジナル) /