I was investigating a connection issue and came across the code. I tried to research the difference but could not find any clear answer to the question.
The main issue we faced was connections not closing for the service bus when using Azure's service bus package. But this looked more like it was not disposed of correctly.
When using dependency injection for adding scoped services, typeof was used.
The first scenario is:
services.AddScoped(typeof(IServiceBusMessageSender), typeof(ServiceBusMessageSender));
Does using typeof do anything different from the 2nd scenario?
The second scenario is:
services.AddScoped<IServiceBusMessageSender, ServiceBusMessageSender>();