2017-08-16 4 views
1

バインドAzure CosmosDB on Azure機能ローカルで実行しています。この機能を使用するには、設定が必要ですか?バインドCosmosDBローカル関数

using Microsoft.Azure.WebJobs; 
using Microsoft.Azure.WebJobs.Host; 
using System.Collections.Generic; 

namespace CDPCompare 
{ 
    public static class CallWS 
    { 
     [FunctionName("TimerTriggerCSharp")] 
     public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log, IEnumerable<dynamic> inputDocument) 
     { 
      foreach(var item in inputDocument) 
      { 
       log.Info(item); 
      } 
     } 
    } 
} 

答えて

1

はい、inputDocument引数には設定が必要です。

この属性を使用して、CosmosのDB名とコレクションを指定する必要があります。あなたは、ドキュメントDB Microsoft.Azure.WebJobs.Extensions.DocumentDBのためのNuGetパッケージを参照する必要があり、その属性をピックアップする

[DocumentDB("%DatabaseName%", "MyCollection")] IEnumerable<dynamic> inputDocuments 

。最後に、このNuGetパッケージがまだリリース前の状態であることを確認しましたので、パッケージを検索する際にそれを含めてください。

enter image description here

関連する問題