自分の進捗状況で編集しました。バイナリAzure関数を使用したDocumentDb
私はAzure関数内でDocumentDbを使用しようとしていますが、私がdllをビルドして展開できる新しいVisual Studio Toolingで書いています。私のfunction.jsonファイルはツールによって作成されるので、function.jsonでバインディングを作成することはできません。属性を使用する必要があります。
私は自分のソリューションにMicrosoft.Azure.Webjobs.Extensions.DocumentDBパッケージを追加しました。私は、関数のシグネチャいる:ツールによってコンパイルfunction.jsonがある
await docdbcli.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri("customerdocumentversionsdb", "snapshots"), new
{
id = "edse",
customer = "expedia",
document = Converter.Serialize(jliff),
version = "sourceedited"
});
::私が持っているメソッド本体で
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]
HttpRequestMessage req,
[DocumentDB("database", "collection"ConnectionStringSetting = "conn", Id = "w", PartitionKey = "customer")) DocumentClient docdbcli,
TraceWriter log)
を
{
"bindings": [
{
"type": "httpTrigger",
"methods": [
"get",
"post"
],
"authLevel": "function",
"direction": "in",
"name": "req"
},
{
"type": "documentDB",
"databaseName": "customerdocumentversionsdb",
"collectionName": "snapshots",
"createIfNotExists": false,
"connection": "conn",
"id": "w",
"partitionKey": "customer",
"direction": "out",
"name": "docdbcli"
},
{
"name": "$return",
"type": "http",
"direction": "out"
}
],
"disabled": false,
"scriptFile": "..\\MtWithRulesFunctionApp.dll",
"entryPoint": "MtWithRulesFunctionApp.PreEditSource.Run"
}
マイドキュメントが書き込まれていませんおそらくバインディングは約のために指定されているからです。
一般的に、あなたはかなり異なるものに質問を編集すべきではありません... – Mikhail