Soenneker.Google.Ads.Client 4.0.640

Prefix Reserved
dotnet add package Soenneker.Google.Ads.Client --version 4.0.640
                    
NuGet\Install-Package Soenneker.Google.Ads.Client -Version 4.0.640
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Google.Ads.Client" Version="4.0.640" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Google.Ads.Client" Version="4.0.640" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Google.Ads.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Google.Ads.Client --version 4.0.640
                    
#r "nuget: Soenneker.Google.Ads.Client, 4.0.640"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Google.Ads.Client@4.0.640
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Google.Ads.Client&version=4.0.640
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Google.Ads.Client&version=4.0.640
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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 GoogleAdsClientUtil yourself, 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.640 0 8/30/2026
4.0.639 0 8/30/2026
4.0.638 0 8/30/2026
4.0.637 0 8/30/2026
4.0.636 5 8/30/2026
4.0.635 29 8/30/2026
4.0.634 38 8/30/2026
4.0.633 36 8/29/2026
4.0.632 34 8/29/2026
4.0.631 35 8/29/2026
4.0.630 40 8/29/2026
4.0.629 70 8/26/2026
4.0.628 72 8/26/2026
4.0.627 61 8/26/2026
4.0.626 71 8/26/2026
4.0.625 72 8/25/2026
4.0.624 84 8/22/2026
4.0.623 165 8/19/2026
4.0.622 83 8/18/2026
4.0.621 96 8/12/2026
Loading failed

Update dependency Soenneker.Extensions.Configuration to 4.0.868 (#1178)