dotnet-client-initialization

Constructs and registers APIMatic-generated .NET SDK clients with HttpClient and dependency injection.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/apimatic/plugin-marketplace --skill dotnet-client-initialization-apimatic
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-client-initialization
Source: https://github.com/apimatic/plugin-marketplace/tree/main/plugins/maxio-sdk/skills/dotnet-client-initialization
Command: npx skills add https://github.com/apimatic/plugin-marketplace --skill dotnet-client-initialization-apimatic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers integrating an APIMatic-generated .NET SDK often mismanage HttpClient lifetimes, misconfigure DI registrations, or miss critical settings like Timeout and PooledConnectionLifetime, leading to socket exhaustion, stale DNS, or hung requests in production. ## Core Features & Use Cases - Client Construction Guidance: Explains the single public client class shape, its options object, and correct direct instantiation with a long-lived HttpClient. - Dependency Injection Registration: Covers the generated Add{Api}Client extension, its transient-vs-singleton lifetime implications, and how to register over a named HttpClient instead. - Resilience-Aware Defaults: Highlights load-bearing settings like Timeout and PooledConnectionLifetime so DNS changes and hung providers do not cause outages. - Use Case: When wiring a payments SDK into an ASP.NET Core service, use this Skill to register the client over a named HttpClient with a bounded timeout and pooled connection lifetime, avoiding the shared default-client pitfalls. ## Quick Start Ask the agent to register the APIMatic .NET SDK client in your ASP.NET Core service collection using a named HttpClient with a configured timeout.

Frequently Asked Questions about dotnet-client-initialization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I register an APIMatic .NET SDK client in ASP.NET Core?▼

Use the generated Add{Api}Client ServiceCollection extension, passing a callback that configures the options object once at registration. It wires an IHttpClientFactory-managed HttpClient resolving the default unnamed factory client.

How should I manage HttpClient lifetime for a generated SDK client?▼

Reuse a single long-lived HttpClient or use IHttpClientFactory; never create one per request. The SDK does not own the HttpClient, and the client itself should also be constructed once and reused for the app's lifetime.

Should the SDK client be registered as singleton or transient?▼

Check the generated extension, since both occur. A transient client is harmless because each resolution gets a fresh factory HttpClient, but a singleton holds one HttpClient forever, so handler rotation never applies and DNS changes are cached indefinitely.

Why does my SDK client hang for 100 seconds on a stalled API?▼

The default HttpClient Timeout is 100 seconds, matching the SDK's per-attempt retry timeout, so a hung provider blocks that long. Set an explicit Timeout, such as 10 seconds, on the named HttpClient registration.

Can I attach custom DelegatingHandlers to the SDK's DI registration?▼

Yes, configure the default unnamed factory client via services.AddHttpClient(Options.DefaultName).AddHttpMessageHandler. Note this handler then applies to every other unnamed CreateClient consumer, so prefer a named HttpClient for isolation.