Modify DI to inject service interface instead of implementation
Opened this issue · 0 comments
BastienPerdriau commented
Hello,
I'm wondering if it could be possible to inject the ILogAnalyticsClient interface instead of LogAnalyticsClient class ?
By replacing
services.AddHttpClient<LogAnalyticsClient>();
by
services.AddHttpClient<ILogAnalyticsClient, LogAnalyticsClient>();
I think it would make a breaking change when getting LogAnalyticsClient in services constructor but it would be more easier to mock services in tests.