Skip to content

Commit b8c9189

Browse files
Updated indentation
1 parent e809e7f commit b8c9189

File tree

1 file changed

+27
-27
lines changed
  • working/templates/dxmsolution/ServiceProject

1 file changed

+27
-27
lines changed

working/templates/dxmsolution/ServiceProject/Worker.cs

+27-27
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,41 @@ namespace $ServiceNameFull$
44

55
public class Worker : BackgroundService
66
{
7-
private readonly ILogger<Worker> logger;
8-
private readonly IConfiguration configuration;
9-
private readonly IFileSystem filesystem;
7+
private readonly ILogger<Worker> logger;
8+
private readonly IConfiguration configuration;
9+
private readonly IFileSystem filesystem;
1010

11-
public Worker(ILogger<Worker> logger, IConfiguration configuration)
12-
{
13-
this.logger = logger;
14-
this.configuration = configuration;
15-
this.filesystem = FileSystem.Instance;
16-
}
11+
public Worker(ILogger<Worker> logger, IConfiguration configuration)
12+
{
13+
this.logger = logger;
14+
this.configuration = configuration;
15+
this.filesystem = FileSystem.Instance;
16+
}
1717

18-
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
19-
{
20-
while (!stoppingToken.IsCancellationRequested)
18+
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
2119
{
22-
#region ExampleCode
23-
// see appsettings.json "WritePath": "C:\\temp\\$DxmModuleName$\\example.txt"
24-
var path = configuration["File:WritePath"];
25-
if (String.IsNullOrWhiteSpace(path))
20+
while (!stoppingToken.IsCancellationRequested)
2621
{
27-
throw new InvalidOperationException("Path for example file writes cannot be null or empty");
28-
}
22+
#region ExampleCode
23+
// see appsettings.json "WritePath": "C:\\temp\\$DxmModuleName$\\example.txt"
24+
var path = configuration["File:WritePath"];
25+
if (String.IsNullOrWhiteSpace(path))
26+
{
27+
throw new InvalidOperationException("Path for example file writes cannot be null or empty");
28+
}
2929

30-
var directory = filesystem.Path.GetDirectoryName(path);
31-
if (!filesystem.Directory.Exists(directory)) filesystem.Directory.CreateDirectory(directory);
30+
var directory = filesystem.Path.GetDirectoryName(path);
31+
if (!filesystem.Directory.Exists(directory)) filesystem.Directory.CreateDirectory(directory);
3232

33-
filesystem.File.AppendAllText(path, $"{Environment.NewLine + DateTimeOffset.Now}: Worker is running.");
34-
#endregion
33+
filesystem.File.AppendAllText(path, $"{Environment.NewLine + DateTimeOffset.Now}: Worker is running.");
34+
#endregion
3535

36-
if (logger.IsEnabled(LogLevel.Information))
37-
{
38-
logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
36+
if (logger.IsEnabled(LogLevel.Information))
37+
{
38+
logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
39+
}
40+
await Task.Delay(1000, stoppingToken);
3941
}
40-
await Task.Delay(1000, stoppingToken);
4142
}
4243
}
43-
}
4444
}

0 commit comments

Comments
 (0)