public async Task <ExampleOutputs> Handler(ExampleInputs args, ILambdaContext context) { if (this.store == null) { // Preload the dependencies (if they exist), // so that they are available during model deserialization. var asmLocation = this.GetType().Assembly.Location; var asmDir = Path.GetDirectoryName(asmLocation); var asmName = Path.GetFileNameWithoutExtension(asmLocation); var depPath = Path.Combine(asmDir, $"{asmName}.Dependencies.dll"); if (File.Exists(depPath)) { Console.WriteLine($"Loading dependencies from assembly: {depPath}..."); Assembly.LoadFrom(depPath); Console.WriteLine("Dependencies assembly loaded."); } this.store = new S3ModelStore <ExampleInputs>(RegionEndpoint.USWest1); } var l = new InvocationWrapper <ExampleInputs, ExampleOutputs>(store, Example.Execute); var output = await l.InvokeAsync(args); return(output); }
/// <summary> /// The Example function. /// </summary> /// <param name="model">The input model.</param> /// <param name="input">The arguments to the execution.</param> /// <returns>A ExampleOutputs instance containing computed results and the model with any new elements.</returns> public static ExampleOutputs Execute(Dictionary <string, Model> inputModels, ExampleInputs input) { /// Your code here. var height = 1.0; var volume = input.Length * input.Width * height; var output = new ExampleOutputs(volume); var rectangle = Polygon.Rectangle(input.Length, input.Width); var mass = new Mass(rectangle, height); output.Model.AddElement(mass); return(output); }