-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFunctions.cs
More file actions
32 lines (26 loc) · 1.1 KB
/
Functions.cs
File metadata and controls
32 lines (26 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Configuration;
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace WebJob_netcore_sample;
public class Functions
{
private readonly IConfiguration _configuration;
private readonly MyService _myService;
private readonly ILogger<Functions> _logger;
public Functions(IConfiguration configuration, MyService myService, ILogger<Functions> logger)
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
_myService = myService ?? throw new ArgumentNullException(nameof(myService));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
public async Task MyTimerTriggerOperation([TimerTrigger("0/15 * * * * *", RunOnStartup = true)] TimerInfo timerInfo, CancellationToken cancellationToken)
{
// Do some work...
await Task.Delay(100, cancellationToken);
_logger.LogInformation("Environment Variables: {vars}", _configuration.AsEnumerable());
_myService.Foo();
}
}