Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring sample app more in line with Microsoft docs #21

Merged
merged 1 commit into from
May 24, 2020

Conversation

ralphhendriks
Copy link

This PR aims to bring the included SimpleServiceSample better in line with the samples given in the Microsoft docs. I think we should strive to keep as close as possible to the archetypical samples given by Microsoft. That makes the typical setup of a hosted service/background service better recognizable, and shows better what is typical to setting up Serilog.

This PR:

  • Updates the sample project to use the Microsoft.NET.Sdk.Worker SDK. This is the default SDK when creating a new project from the template 'Worker Service'.
  • Updates the targeting to netcore3.1.
  • Simplifies the sample service by deriving from BackgroundService instead of implementing IHostedService directly. This leads to a simpler example (better focus on the mechanics of setting up and configuring Serilog). As there are some caveats with implementing IHostedService directly, devs new to worker services are better of starting from BackgroundService.
  • No longer ignores tracking of launchSettings.json.

- Update the sample project to use the `Microsoft.NET.Sdk.Worker` SDK.
  This is the default SDK when creating a new project from the template
  'Worker Service'.
- Target `netcore3.1`.
- Simplify the sample service by deriving from `BackgroundService`
  instead of implementing `IHostedService` directly. This leads to a
  simpler example (better focus on the mechanics of setting up and
  configuring Serilog). As there are some caveats with implementing
  `IHostedService` directly, devs new to worker services are better of
  starting from `BackgroundService`.
- Start tracking `launchSettings.json`.
Copy link

@skomis-mm skomis-mm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@nblumhardt nblumhardt merged commit a05519e into serilog:dev May 24, 2020
@nblumhardt
Copy link
Member

Awesome 👍

@nblumhardt nblumhardt mentioned this pull request May 26, 2020
@ralphhendriks ralphhendriks deleted the sample-to-netcoreapp3.1 branch May 26, 2020 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants