LogAnalytics.Client icon indicating copy to clipboard operation
LogAnalytics.Client copied to clipboard

Modify DI to inject service interface instead of implementation

Open BastienPerdriau opened this issue 2 years ago • 0 comments

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.

BastienPerdriau avatar Aug 18 '23 12:08 BastienPerdriau