Skip to content

Instantly share code, notes, and snippets.

@ealsur
Created January 30, 2018 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ealsur/a615fc68b70d9e9aafe8a6d032292a9a to your computer and use it in GitHub Desktop.
Save ealsur/a615fc68b70d9e9aafe8a6d032292a9a to your computer and use it in GitHub Desktop.
Azure Cosmos DB + Functions Cookbook - output collector run.csx
using System.Net;
public class MyClass {
public string id {get;set;}
public string name {get;set;}
}
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, MyClass[] classes, TraceWriter log, IAsyncCollector<MyClass> documentsToStore)
{
log.Info($"Detected {classes.Length} incoming documents");
foreach(MyClass aClass in classes){
await documentsToStore.AddAsync(aClass);
}
return req.CreateResponse(HttpStatusCode.Created);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment