Skip to content

Instantly share code, notes, and snippets.

@xximjasonxx
Created December 28, 2019 23:38
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 xximjasonxx/13e1205d5f7382dba648daf8d0c6bdbb to your computer and use it in GitHub Desktop.
Save xximjasonxx/13e1205d5f7382dba648daf8d0c6bdbb to your computer and use it in GitHub Desktop.
public class UserTokenExtensionProvider : IExtensionConfigProvider
{
private readonly IConfiguration _configuration;
public UserTokenExtensionProvider(IConfiguration configuration)
{
_configuration = configuration;
}
public void Initialize(ExtensionConfigContext context)
{
var serviceCollection = new ServiceCollection();
serviceCollection.RegisterDependencies();
serviceCollection.AddSingleton<IConfiguration>(_configuration);
var serviceProvider = serviceCollection.BuildServiceProvider();
context.AddBindingRule<UserTokenAttribute>().Bind(new UserTokenBindingProvider(serviceProvider));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment