Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 1.29 KB

functions-add-storage-binding-csharp-library.md

File metadata and controls

19 lines (13 loc) · 1.29 KB
author ms.service ms.topic ms.date ms.author
ggailey777
azure-functions
include
07/05/2019
glenga

In a C# class library project, the bindings are defined as binding attributes on the function method. The function.json file required by Functions is then auto-generated based on these attributes.

Open the HttpExample.cs project file and add the following parameter to the Run method definition:

:::code language="csharp" source="~/functions-docs-csharp/functions-add-output-binding-storage-queue-cli/HttpExample.cs" range="17":::

The msg parameter is an ICollector<T> type, which represents a collection of messages that are written to an output binding when the function completes. In this case, the output is a storage queue named outqueue. The connection string for the Storage account is set by the StorageAccountAttribute. This attribute indicates the setting that contains the Storage account connection string and can be applied at the class, method, or parameter level. In this case, you could omit StorageAccountAttribute because you are already using the default storage account.

The Run method definition should now look like the following:

:::code language="csharp" source="~/functions-docs-csharp/functions-add-output-binding-storage-queue-cli/HttpExample.cs" range="14-18":::