Soenneker.Google.Ads.Client
11.0.734
Prefix Reserved
dotnet add package Soenneker.Google.Ads.Client --version 11.0.734
NuGet\Install-Package Soenneker.Google.Ads.Client -Version 11.0.734
<PackageReference Include="Soenneker.Google.Ads.Client" Version="11.0.734" />
<PackageVersion Include="Soenneker.Google.Ads.Client" Version="11.0.734" />
<PackageReference Include="Soenneker.Google.Ads.Client" />
paket add Soenneker.Google.Ads.Client --version 11.0.734
#r "nuget: Soenneker.Google.Ads.Client, 11.0.734"
#:package Soenneker.Google.Ads.Client@11.0.734
#addin nuget:?package=Soenneker.Google.Ads.Client&version=11.0.734
#tool nuget:?package=Soenneker.Google.Ads.Client&version=11.0.734
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 | net11.0 is compatible. |
-
net11.0
- Google.Ads.Gax (>= 4.0.8)
- Google.Ads.GoogleAds.Core (>= 4.0.11)
- Soenneker.Extensions.Configuration (>= 11.0.919)
- Soenneker.Utils.AsyncSingleton (>= 11.0.898)
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 |
|---|---|---|
| 11.0.734 | 51 | 11/29/2026 |
| 11.0.733 | 54 | 11/29/2026 |
| 11.0.732 | 107 | 11/19/2026 |
| 11.0.731 | 90 | 11/18/2026 |
| 11.0.730 | 100 | 11/18/2026 |
| 11.0.728 | 125 | 11/11/2026 |
| 11.0.727 | 102 | 11/11/2026 |
| 11.0.726 | 102 | 11/11/2026 |
| 11.0.725 | 110 | 11/11/2026 |
| 11.0.724 | 101 | 11/11/2026 |
| 11.0.723 | 103 | 11/10/2026 |
| 11.0.722 | 208 | 11/3/2026 |
| 11.0.721 | 138 | 10/27/2026 |
| 11.0.720 | 108 | 10/26/2026 |
| 11.0.719 | 111 | 10/26/2026 |
| 11.0.718 | 103 | 10/26/2026 |
| 11.0.717 | 102 | 10/26/2026 |
| 11.0.716 | 111 | 10/26/2026 |
| 11.0.715 | 112 | 10/26/2026 |
| 4.0.713 | 111 | 10/26/2026 |
Updated Multiple NuGet packages