Skip to Content
Serverless computing in Azure with .NET
book

Serverless computing in Azure with .NET

by Sasha Rosenbaum
August 2017
Intermediate to advanced
468 pages
12h 5m
English
Packt Publishing
Content preview from Serverless computing in Azure with .NET

Function code

Let's take a look at the following steps to create the function code:

  1. In the project tree, browse to the ScoreDocument.cs file.
  2. Let's replace the generated code with the following code.

The following function code assumes that the uploaded file is a text file that can be processed using StreamReader. Upon execution, the file content will be stored in the blobContent variable, while the file name will be stored in the name parameter. (The code is kept short for clarity. In production code, we would also need to perform input validation).

The code is as follows:

        public static class ScoreDocument        {          [FunctionName("ScoreDocument")]           public static async Task Run(               [BlobTrigger("documents/{name}", Connection =    "blobStorageConnection")] ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Azure Serverless Computing

Mastering Azure Serverless Computing

Lorenzo Barbieri, Massimo Bonanni
Implementing Azure: Putting Modern DevOps to Use

Implementing Azure: Putting Modern DevOps to Use

Florian Klaffenbach, Oliver Michalski, Markus Klein, Mohamed Wali

Publisher Resources

ISBN: 9781787288393Supplemental Content