Azure Function Binder Blob FileName

时间:2018-02-05 16:45:56

标签: azure-functions

我需要Azure Blob文件名。 我在Visual Studio中使用Azure Functions。这是代码:

public static async Task Run(
        [BlobTrigger("containerfromftp/{name}", Connection = "AzureBlobStorage")]Stream imageBlob,
        IBinder binder)
{
   var cloudBlob = await binder.BindAsync<ICloudBlob>(new 
   BlobAttribute("containerfromftp/{name}"));
}

我想使用binder来获取信息。在IBinder中,在私有变量中,我找到了我想要的东西。

在下图中我正在尝试使用的数据。

Visual Studio Debugger

我的坏方案:

string blobName = (string)((Binder)binder).BindingData.FirstOrDefault(x => x.Key == "name").Value

1 个答案:

答案 0 :(得分:0)

参数可以直接绑定到绑定数据,如此

   public static async Task Run(
      [BlobTrigger("containerfromftp/{name}")] Stream imageBlob,
      string  name, // returns the {name} capture 
   )