-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR makes use of file scoped namespaces and Implicit Usings
- Loading branch information
1 parent
430efad
commit e2ce83b
Showing
107 changed files
with
5,152 additions
and
5,378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# editorconfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# CSharp formatting rules: | ||
[*.cs] | ||
csharp_style_namespace_declarations =file_scoped:warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,38 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
namespace LogAnalyticsSample; | ||
|
||
namespace LogAnalyticsSample | ||
class Program | ||
{ | ||
class Program | ||
static async Task Main(string[] args) | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
await Host.CreateDefaultBuilder(args) | ||
.ConfigureLogging((context, loggingBuilder) => | ||
{ | ||
loggingBuilder.AddLogAnalytics(context.Configuration.GetSection("LogAnalytics")); | ||
}) | ||
.ConfigureServices((context, services) => | ||
{ | ||
services.AddHostedService<TestService>(); | ||
}) | ||
.RunConsoleAsync(); | ||
} | ||
|
||
await Host.CreateDefaultBuilder(args) | ||
.ConfigureLogging((context, loggingBuilder) => | ||
{ | ||
loggingBuilder.AddLogAnalytics(context.Configuration.GetSection("LogAnalytics")); | ||
}) | ||
.ConfigureServices((context, services) => | ||
{ | ||
services.AddHostedService<TestService>(); | ||
}) | ||
.RunConsoleAsync(); | ||
} | ||
|
||
class TestService : BackgroundService | ||
{ | ||
private readonly ILogger logger; | ||
} | ||
|
||
public TestService(ILogger<TestService> logger) | ||
{ | ||
this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); | ||
} | ||
class TestService : BackgroundService | ||
{ | ||
private readonly ILogger logger; | ||
|
||
public TestService(ILogger<TestService> logger) | ||
{ | ||
this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); | ||
} | ||
|
||
protected override async Task ExecuteAsync(CancellationToken stoppingToken) | ||
protected override async Task ExecuteAsync(CancellationToken stoppingToken) | ||
{ | ||
for (var i = 1; i <= 5; i++) | ||
{ | ||
for (var i = 1; i <= 5; i++) | ||
{ | ||
logger.LogInformation("In am working on something. Iteration {IterationNumber}", i); | ||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); | ||
} | ||
logger.LogInformation("In am working on something. Iteration {IterationNumber}", i); | ||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); | ||
} | ||
} | ||
} |
Oops, something went wrong.