Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created November 21, 2016 02:05
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/c46e18f9d29af94e97f292d00f061a8d to your computer and use it in GitHub Desktop.
Save justinyoo/c46e18f9d29af94e97f292d00f061a8d 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 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 = service.GetUsers(entities);
log.Info(JsonConvert.SerializeObject(users));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment