Consider adding IServiceProvider parameter to AddSqlServer
Closed this issue · 4 comments
There is no options to easily inject IServiceProvider into AddSqlServer for cases such as retrieving required service before configuring SignalR for SQL Server backplane
This library uses Microsoft's Options pattern, and this scenario is supported by that. As such, we won't be adding any specific overloads that wrap that underlying functionality. Instead, use the functionality from Microsoft.Extensions.Options directly:
services
.AddOptions<IntelliTect.AspNetCore.SignalR.SqlServer.SqlServerOptions>()
.Configure<MyService>((o, myService) =>
{
o.ConnectionString = myService.GetConnectionString()
});
I tried your approach, but it seems not working as expected (no tables are created). Is there any way to turn on/off logging to investigate the issue behind the scene ?
Microsoft.Extensions.Logging is used for logging, so just configure the log level to the desired level. For example, via appsettings.json:
{
"Logging": {
"LogLevel": {
"IntelliTect.AspNetCore.SignalR": "Trace"
}
}
}
But do note that the message "SignalR SQL objects installed" is logged at the Information level when tables have been successfully installed, and an error is logged at the Error level if there is a failure. It is unlikely that you will benefit from logging levels more detailed than Information.
Logging really helped to trace down the issue, I got it working, thanks