-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IHostedLifecycleService (#87335)
- Loading branch information
1 parent
7273f84
commit abcd91c
Showing
10 changed files
with
1,530 additions
and
96 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
44 changes: 44 additions & 0 deletions
44
src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostedLifecycleService.cs
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,44 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Threading.Tasks; | ||
using System.Threading; | ||
|
||
namespace Microsoft.Extensions.Hosting | ||
{ | ||
/// <summary> | ||
/// Defines methods that are run before or after | ||
/// <see cref="IHostedService.StartAsync(CancellationToken)"/> and | ||
/// <see cref="IHostedService.StopAsync(CancellationToken)"/>. | ||
/// </summary> | ||
public interface IHostedLifecycleService : IHostedService | ||
{ | ||
/// <summary> | ||
/// Triggered before <see cref="IHostedService.StartAsync(CancellationToken)"/>. | ||
/// </summary> | ||
/// <param name="cancellationToken">Indicates that the start process has been aborted.</param> | ||
/// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns> | ||
Task StartingAsync(CancellationToken cancellationToken); | ||
|
||
/// <summary> | ||
/// Triggered after <see cref="IHostedService.StartAsync(CancellationToken)"/>. | ||
/// </summary> | ||
/// <param name="cancellationToken">Indicates that the start process has been aborted.</param> | ||
/// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns> | ||
Task StartedAsync(CancellationToken cancellationToken); | ||
|
||
/// <summary> | ||
/// Triggered before <see cref="IHostedService.StopAsync(CancellationToken)"/>. | ||
/// </summary> | ||
/// <param name="cancellationToken">Indicates that the start process has been aborted.</param> | ||
/// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns> | ||
Task StoppingAsync(CancellationToken cancellationToken); | ||
|
||
/// <summary> | ||
/// Triggered after <see cref="IHostedService.StopAsync(CancellationToken)"/>. | ||
/// </summary> | ||
/// <param name="cancellationToken">Indicates that the stop process has been aborted.</param> | ||
/// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns> | ||
Task StoppedAsync(CancellationToken cancellationToken); | ||
} | ||
} |
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
Oops, something went wrong.