-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from lorenalexm/services-extension
Added service injection extension, bumped version
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
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,20 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace StrapiSharp.Extensions | ||
{ | ||
public static class ServiceCollectionExtension | ||
{ | ||
/// <summary> | ||
/// Adds a <see cref="Strapi"/> object as a singleton instance. | ||
/// </summary> | ||
/// <param name="services"><see cref="IServiceCollection"/>.</param> | ||
/// <param name="host">The Strapi host to make requests against.</param> | ||
/// <returns>Continues the <see cref="IServiceCollection"/> chain.</returns> | ||
public static IServiceCollection AddStrapiSharp(this IServiceCollection services, string host) | ||
{ | ||
services.AddSingleton(new Strapi(host)); | ||
return services; | ||
} | ||
} | ||
} | ||
|
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