Skip to content

Instantly share code, notes, and snippets.

@kasunkv
Created June 9, 2019 11:44
Show Gist options
  • Save kasunkv/9bf641f82e7ea101eb59b3a0ed8198c3 to your computer and use it in GitHub Desktop.
Save kasunkv/9bf641f82e7ea101eb59b3a0ed8198c3 to your computer and use it in GitHub Desktop.
Construction Injecting the Dependencies in to Azure Function.
namespace Function.DependencyInjection.Timer
{
public class TimeFunction
{
private readonly IHelloService _helloService;
public TimeFunction(IHelloService helloService)
{
_helloService = helloService;
}
[FunctionName("TimeFunction")]
public void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"OUTPUT: {_helloService.SayHello("Kasun Kodagoda")}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment