google-ads-dotnet
google-ads-dotnet copied to clipboard
Add GoogleAdsClient to DI container
With minimal impact to the Google.Ads.GoogleAds.Core
project (only adding two interfaces), this PR introduces the Google.Ads.GoogleAds.Extensions.DependencyInjection
project. This new project can be packaged independently providing flexibility to include it only when needed. If using dependency injection, GoogleAds can now be configured and injected into the DI container with one line:
services.AddGoogleAdsClient(Configuration);
Once called, the DI container has a configured IGoogleAdsClient
that can be injected like any other dependency.
The test project, Google.Ads.GoogleAds.Extensions.DependencyInjection.Tests
, shows this in action.
Closes #483