Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created November 21, 2016 02:06
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 justinyoo/cbf011b638bff5a2c33c96b5bb3ca644 to your computer and use it in GitHub Desktop.
Save justinyoo/cbf011b638bff5a2c33c96b5bb3ca644 to your computer and use it in GitHub Desktop.
Managing Dependencies in Azure Functions
#load "..\Shared\ServiceLocator.csx"
#r "Newtonsoft.Json"
using System;
using Functions.EntityModels;
using Functions.Services;
using Newtonsoft.Json;
public static async void Run(string input, TraceWriter log)
{
log.Info($"C# manually triggered function called with input: {input}");
var instance = locator.Instance;
var service = instance.GetInstance<IUserService>();
var entities = new List<User>
{
new User() { UserId = Guid.NewGuid(), FirstName = "Jane", LastName = "Doe" },
new User() { UserId = Guid.NewGuid(), FirstName = "Joe", LastName = "Bloggs" }
};
var users = await service.GetUsersAsync(entities).ConfigureAwait(false);
log.Info(JsonConvert.SerializeObject(users));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment