Created
December 28, 2019 23:38
-
-
Save xximjasonxx/13e1205d5f7382dba648daf8d0c6bdbb to your computer and use it in GitHub Desktop.
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
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