'Inject service to configure SignalR backplane

I am trying to use Azure Redis instance as the backplane for my dotnet core signalr application. I need to pull the configuration settings from a database. How do I inject a service to AddStackExchangeRedis()?

            services
            .AddSignalR()
            .AddStackExchangeRedis(options =>
            {
                var settingsService = provider.GetRequiredService<SettingsService>();
                var redisOptions = settingsService.GetOptions();
                options.Configuration.ChannelPrefix = "MyChannel";
            });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source