Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ public static class ServiceCollectionHostedServiceExtensions
/// <summary>
/// Add an <see cref="IHostedService"/> registration for the given type.
/// </summary>
/// <remarks>
/// Note that this creates registration for <see cref="IHostedService"/> specifically. Not for the actual <c>THostedService</c> type.
/// If you want to register the actual type, you must do so separately.
/// </remarks>
/// <example>
/// <para>
/// The following code shows how to register a hosted service while also registering the actual <c>THostedService</c> type.
/// </para>
/// <code language="csharp">
/// services.AddSingleton&lt;SomeService&gt;();
/// services.AddHostedService(sp => sp.GetRequiredService&lt;SomeService&gt;());
/// </code>
/// </example>
/// <typeparam name="THostedService">An <see cref="IHostedService"/> to register.</typeparam>
/// <param name="services">The <see cref="IServiceCollection"/> to register with.</param>
/// <returns>The original <see cref="IServiceCollection"/>.</returns>
Expand All @@ -30,6 +43,19 @@ public static class ServiceCollectionHostedServiceExtensions
/// <summary>
/// Add an <see cref="IHostedService"/> registration for the given type.
/// </summary>
/// <remarks>
/// Note that this creates registration for <see cref="IHostedService"/> specifically. Not for the actual <c>THostedService</c> type.
/// If you want to register the actual type, you must do so separately.
/// </remarks>
/// <example>
/// <para>
/// The following code shows how to register a hosted service while also registering the actual <c>THostedService</c> type.
/// </para>
/// <code language="csharp">
/// services.AddSingleton&lt;SomeService&gt;(implementationFactory);
/// services.AddHostedService(sp => sp.GetRequiredService&lt;SomeService&gt;());
/// </code>
/// </example>
/// <typeparam name="THostedService">An <see cref="IHostedService"/> to register.</typeparam>
/// <param name="services">The <see cref="IServiceCollection"/> to register with.</param>
/// <param name="implementationFactory">A factory to create new instances of the service implementation.</param>
Expand Down
Loading