Supabaseguillaume_faasTutorial
Getting started with the Supabase .NET SDK
Summary
The Supabase .NET SDK provides a single C# client for Auth, Database, Storage, Realtime, and Edge Functions; version 8.0.0 moves serialization to System.Text.Json and adds injectable HttpClient with retry. It also ships a dependency injection package for ASP.NET Core that registers the client as scoped via IHttpClientFactory to pool connections. Models derive from BaseModel with table and column attributes; queries use From () with Where filters, and updates require explicit calls without a change tracker, supporting both model-based and query-builder approaches. Authentication covers email/password, OAuth, magic links, phone, and SSO, with auto-refresh tokens attaching to subsequent requests for Row-Level Security. Setup for ASP.NET Core uses AddSupabase, while other apps construct the client manually and call InitializeAsync; the post also distinguishes publishable and anon keys for client apps from secret and service keys that bypass Row-Level Security.
Approach / What changed
Install the Supabase meta-package, define a model class inheriting from BaseModel with table and column attributes, configure the client using AddSupabase for ASP.NET Core or manual Client construction for other apps, then perform queries, inserts, updates, deletes, authentication, and file uploads through the client’s sub-services.
Takeaways
Version 8.0.0 switches serialization to System.Text.Json and adds injectable HttpClient with opt-in retry.
The dependency injection package registers the client as scoped via IHttpClientFactory to prevent connection pool exhaustion.
Models require explicit Update/Delete calls without a change tracker; updates can be done on retrieved models or via the query builder.
FAQ
How do I set up the Supabase .NET SDK in an ASP.NET Core app?
Install the Supabase.Extensions.DependencyInjection package, then call builder.Services.AddSupabase in Program.cs with your Supabase URL and key. This registers the client as a scoped service via IHttpClientFactory to pool connections and avoid socket exhaustion.
What changed in version 8.0.0?
Version 8.0.0 switches serialization from Newtonsoft.Json to System.Text.Json, adds an injectable HttpClient with opt-in retry, and introduces a dependency injection package for ASP.NET Core. It also drops .NET Framework support by targeting .NET Standard 2.1.
How do I perform updates without fetching the model first?
Use the query builder: call supabase.From<T>().Set(property, value).Where(filter).Update() to update rows without fetching them first. This saves a round trip compared to retrieving the model, modifying it, and calling Update on the model.
Source and freshness
- Source
- supabase.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.