---
slug: dotnet-dependency-injection-extension
published: 2026-10-12
change_type: new-feature
affected_products:
  - supabase-dotnet
page: https://supabase.com/changelog/dotnet-dependency-injection-extension
---

# ASP.NET Core dependency injection for the Supabase .NET SDK

## What's new

`Supabase.Extensions.DependencyInjection` is a new package that provides an easier way to plug the Supabase .NET SDK into your application. It exposes a new method on `IServiceCollection` called `AddSupabase` which registers the main client and all sub-clients:

```csharp
builder.Services.AddSupabase(
    supabaseUrl: "https://xyz.supabase.co",
    supabaseKey: builder.Configuration["Supabase:Key"]!,
    configureOptions: options =>
    {
        options.AutoConnectRealtime = true;
        options.PostgrestRetry = new RetryOptions { MaxRetries = 3 };
    });
```

It registers all clients (`Supabase.Client`, `IGotrueClient`, `IPostgrestClient`, `IStorageClient`, `IFunctionsClient`, `IRealtimeClient`) with a scoped lifecycle, so you can resolve them wherever you need them:

```csharp
app.MapGet("/movies", async (IPostgrestClient postgrest) =>
    await postgrest.Table<Movie>().Get());
```

The package is available on [NuGet](https://www.nuget.org/packages/Supabase.Extensions.DependencyInjection/):

```sh
dotnet add package Supabase.Extensions.DependencyInjection
```

## Why it matters

You can always register all the required clients in `IServiceCollection` yourself. This package simply does it all for you and removes boilerplate from your codebase.
