Introducing .NET Support

Chase Douglas

I'm super excited to announce our .NET support! We heard from many .NET shops that want to use serverless tech but were hesitant to do so because of a lack of mature tools to enable them. Now, Stackery fills this void.

Let's take a look at building a .NET stack.

Start by adding a Function node to your stack, changing the runtime to .NET. While you can view and edit the main Handler.cs file in the Stackery dashboard, you probably will want to use your existing IDE to develop your Function code.

In Visual Studio 2017 and Visual Studio Code you can clone the Git repository for your stack, whether it's in AWS CodeCommit or a GitHub repo. Inside your function you will find a Stackery.csproj file where the requisite Stackery package is automatically included as a dependency.

You can add more dependencies, and, just as with our Node.js support, your Function code will be automatically built for you at deployment time. No more fiddling around with building, zipping, and uploading archives of code to AWS Lambda!

Another helpful addition is our automatic marshaling of data into and out of your function. In contrast to AWS Lambda, which either hands you a Stream or requires you to use a special AWS-specific converter mechanism, Stackery intelligently determines the data types used by your handler function and serializes to and from the underlying JSON message using the Json.NET library. Here's a simple rest api handler where the message and response are automatically serialized into provided Stackery object types.

using System; using System.Collections.Generic; using System.Text; using Stackery; namespace StackeryFunction { public class Handler { public RestApiExpectedResponse handler(RestApiMessage message) { Console.WriteLine("Path: " + message.pathname); return new RestApiExpectedResponse { statusCode = 200, body = Encoding.UTF8.GetBytes("Hello world!"), headers = new Dictionary<string, string> { {"Content-Type", "text/plain"} } }; } } }

You can marshal your own data types just as easily. Classes with simple data types like strings, numbers, arrays, and dictionaries usually marshal without any extra effort. Types that need extra effort are easily converted using Json.NET serialization attributes.

Stackery's .NET support opens up the serverless world for a new class of developers. We're excited for the possibilities! For more in-depth details, see our Function documentation. Give it a spin and let us know what amazing projects you're building with Stackery!

Related posts

Stackery Support For NoSQL Tables
Cloud InfrastructureStackery Support For NoSQL Tables

© 2022 Stackery. All rights reserved.