Skip to content

Commit 095cc3a

Browse files
author
Roman Lumetsberger
committed
added dotnetcore2.0 example
1 parent b7516e1 commit 095cc3a

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

examples/dotnetcore2.0/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUILD: docker run --rm -v "$PWD"/test:/app microsoft/dotnet:sdk /usr/share/dotnet/dotnet publish /app -c Release -o pub
2+
RUN: docker run --rm -v "$PWD"/test/pub:/var/task lambci/lambda:dotnetcore2.0 test::test.Function::FunctionHandler "some"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
BUILD: docker run --rm -v "$PWD"/test:/app microsoft/dotnet:sdk /usr/share/dotnet/dotnet publish /app -c Release -o pub
3+
RUN: docker run --rm -v "$PWD"/test/pub:/var/task lambci/lambda:dotnetcore2.0 test::test.Function::FunctionHandler "some"
4+
*/
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Threading.Tasks;
10+
using Amazon.Lambda.Core;
11+
using System.IO;
12+
13+
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
14+
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
15+
16+
namespace test
17+
{
18+
public class Function
19+
{
20+
21+
public string FunctionHandler(Stream stream, ILambdaContext context)
22+
{
23+
context.Logger.Log("Log Hello world");
24+
return "Hallo world!";
25+
}
26+
}
27+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Amazon.Lambda.Core" Version="1.0.0" />
10+
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.1.0" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="2.0.1" />
15+
</ItemGroup>
16+
17+
</Project>

0 commit comments

Comments
 (0)