Soenneker.Google.Ads.Client
4.0.638
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Google.Ads.Client --version 4.0.638
NuGet\Install-Package Soenneker.Google.Ads.Client -Version 4.0.638
<PackageReference Include="Soenneker.Google.Ads.Client" Version="4.0.638" />
<PackageVersion Include="Soenneker.Google.Ads.Client" Version="4.0.638" />
<PackageReference Include="Soenneker.Google.Ads.Client" />
paket add Soenneker.Google.Ads.Client --version 4.0.638
#r "nuget: Soenneker.Google.Ads.Client, 4.0.638"
#:package Soenneker.Google.Ads.Client@4.0.638
#addin nuget:?package=Soenneker.Google.Ads.Client&version=4.0.638
#tool nuget:?package=Soenneker.Google.Ads.Client&version=4.0.638
Soenneker.Google.Ads.Client
A lazy, thread-safe GoogleAdsClient provider with dependency-injection registration and deterministic disposal.
Install
dotnet add package Soenneker.Google.Ads.Client
Configuration
{
"Google": {
"Ads": {
"DeveloperToken": "<developer token>",
"ClientId": "<OAuth client ID>",
"ClientSecret": "<OAuth client secret>"
}
}
}
The values are read when Get() first creates the client, not during service registration.
Registration
using Soenneker.Google.Ads.Client.Registrars;
using Microsoft.Extensions.DependencyInjection;
services.AddGoogleAdsClientUtilAsSingleton();
Singleton registration is the normal choice for this package: callers and scoped utilities can share the long-lived Google Ads client while their own scopes are disposed independently.
AddGoogleAdsClientUtilAsScoped() is available when a separate client really is required per scope; disposing the scope then disposes that scope's provider and client.
Usage
public sealed class CampaignReader
{
private readonly IGoogleAdsClientUtil _clientUtil;
public CampaignReader(IGoogleAdsClientUtil clientUtil)
{
_clientUtil = clientUtil;
}
public async ValueTask<GoogleAdsClient> GetClient(CancellationToken cancellationToken)
{
return await _clientUtil.Get(cancellationToken);
}
}
Every Get() call on the same provider returns the same lazily created GoogleAdsClient. Concurrent first calls share one initialization.
API at a glance
| API | What it does | Result / important behavior |
|---|---|---|
Get(cancellationToken) |
Gets or creates the configured client. | Reuses one client for the lifetime of the provider. |
AddGoogleAdsClientUtilAsSingleton() |
Registers one provider for the application. | Recommended for sharing the client across scoped consumers. |
AddGoogleAdsClientUtilAsScoped() |
Registers one provider per DI scope. | Each scope creates and owns a separate client. |
Practical notes
- Let the DI container dispose registered instances. If you construct
GoogleAdsClientUtilyourself, dispose it asynchronously or synchronously when finished. - Cancellation affects pending lazy initialization. It does not cancel operations performed later through the returned Google Ads client.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Google.Ads.GoogleAds (>= 27.2.0)
- Soenneker.Extensions.Configuration (>= 4.0.866)
- Soenneker.Utils.AsyncSingleton (>= 4.0.826)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.663 | 49 | 9/10/2026 |
| 4.0.662 | 71 | 9/9/2026 |
| 4.0.661 | 66 | 9/9/2026 |
| 4.0.660 | 71 | 9/8/2026 |
| 4.0.659 | 77 | 9/8/2026 |
| 4.0.658 | 79 | 9/8/2026 |
| 4.0.657 | 93 | 9/7/2026 |
| 4.0.656 | 88 | 9/7/2026 |
| 4.0.655 | 76 | 9/7/2026 |
| 4.0.654 | 80 | 9/5/2026 |
| 4.0.653 | 95 | 9/4/2026 |
| 4.0.652 | 84 | 9/4/2026 |
| 4.0.651 | 82 | 9/4/2026 |
| 4.0.649 | 86 | 9/4/2026 |
| 4.0.648 | 80 | 9/4/2026 |
| 4.0.647 | 91 | 9/3/2026 |
| 4.0.646 | 102 | 8/31/2026 |
| 4.0.645 | 90 | 8/31/2026 |
| 4.0.644 | 83 | 8/31/2026 |
| 4.0.638 | 89 | 8/30/2026 |
Document Google Ads client ownership and usage