Skip to content

Instantly share code, notes, and snippets.

@jasongaylord
Created November 6, 2018 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongaylord/f4b824f341fc38cc6fa2847bd919e275 to your computer and use it in GitHub Desktop.
Save jasongaylord/f4b824f341fc38cc6fa2847bd919e275 to your computer and use it in GitHub Desktop.
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection.Extensions;
using TwitterViewComponent;
namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddTwitter(this IServiceCollection services, IConfiguration configuration = null)
{
if (configuration != null)
services.Configure<TwitterOptions>(configuration);
else
services.TryAddSingleton<TwitterOptions, TwitterOptions>();
services.TryAddScoped<ITwitterService, TwitterService>();
return services;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment