更新时间:2023-02-14 12:29:50
您的问题来自运行时将命令式绑定解释为输入绑定这一事实.那是因为您要请求自定义类型(MinifiedUrl
),所以应该从数据库中加载这是很有意义的.
Your problems come from the fact that runtime interprets your imperative binding as input one. That's because you are requesting the custom type (MinifiedUrl
), so it makes sense that this value should be loaded from the database.
要输出绑定,应请求IAsyncCollector
类型,然后在其上调用AddAsync
:
To make your binding output, you should request IAsyncCollector
type, and then call AddAsync
on it:
var output = await binder.BindAsync<IAsyncCollector<MinifiedUrl>>(
new DocumentDBAttribute("TablesDB", "minified-urls")
{
CreateIfNotExists = true,
ConnectionStringSetting = "CosmosConnectionString"
});
await output.AddAsync(new MinifiedUrl(...));