From dec52496e5d020e861deb7767cc53009896a4fe5 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 26 May 2026 08:11:24 -0400 Subject: [PATCH] docs: update C# connection signatures --- .../00600-clients/00300-connection.md | 8 ++++---- .../00600-clients/00600-csharp-reference.md | 16 +++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00300-connection.md b/docs/docs/00200-core-concepts/00600-clients/00300-connection.md index 270d6901570..ec7b2d63591 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00300-connection.md +++ b/docs/docs/00200-core-concepts/00600-clients/00300-connection.md @@ -38,7 +38,7 @@ const conn = new DbConnection.builder() using SpacetimeDB; var conn = DbConnection.Builder() - .WithUri(new Uri("https://maincloud.spacetimedb.com")) + .WithUri("https://maincloud.spacetimedb.com") .WithDatabaseName("my_database") .Build(); ``` @@ -90,7 +90,7 @@ const conn = new DbConnection.builder() ```csharp var conn = DbConnection.Builder() - .WithUri(new Uri("https://maincloud.spacetimedb.com")) + .WithUri("https://maincloud.spacetimedb.com") .WithDatabaseName("my_database") .Build(); ``` @@ -137,7 +137,7 @@ const conn = new DbConnection.builder() ```csharp var conn = DbConnection.Builder() - .WithUri(new Uri("https://maincloud.spacetimedb.com")) + .WithUri("https://maincloud.spacetimedb.com") .WithDatabaseName("my_database") .WithToken("your_auth_token_here") .Build(); @@ -256,7 +256,7 @@ const conn = DbConnection.builder() ```csharp var conn = DbConnection.Builder() - .WithUri(new Uri("https://maincloud.spacetimedb.com")) + .WithUri("https://maincloud.spacetimedb.com") .WithDatabaseName("my_database") .OnConnect((conn, identity, token) => { diff --git a/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md b/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md index 34ec9a8fa7b..95211699ac4 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md @@ -39,7 +39,7 @@ Before diving into the reference, you may want to review: | [`EventContext` type](#type-eventcontext) | Implements [`IDbContext`](#interface-idbcontext) for [row callbacks](#callback-oninsert). | | [`ReducerEventContext` type](#type-reducereventcontext) | Implements [`IDbContext`](#interface-idbcontext) for [reducer callbacks](#observe-and-invoke-reducers). | | [`SubscriptionEventContext` type](#type-subscriptioneventcontext) | Implements [`IDbContext`](#interface-idbcontext) for [subscription callbacks](#subscribe-to-queries). | -| [`ErrorContext` type](#type-errorcontext) | Implements [`IDbContext`](#interface-idbcontext) for error-related callbacks. | +| [`ErrorContext` type](#type-errorcontext) | Implements [`IDbContext`](#interface-idbcontext) for subscription error callbacks. | | [Query Builder API](#query-builder-api) | Type-safe query builder for typed subscription queries. | | [Access the client cache](#access-the-client-cache) | Access to your local view of the database. | | [Observe and invoke reducers](#observe-and-invoke-reducers) | Send requests to the database to run reducers, and register callbacks to run when notified of reducers. | @@ -115,7 +115,7 @@ Construct a `DbConnection` by calling `DbConnection.Builder()`, chaining configu ```csharp class DbConnectionBuilder { - public DbConnectionBuilder WithUri(Uri uri); + public DbConnectionBuilder WithUri(string uri); } ``` @@ -163,20 +163,18 @@ Chain a call to `.OnConnect(callback)` to your builder to register a callback to ```csharp class DbConnectionBuilder { - public DbConnectionBuilder OnConnectError(Action callback); + public DbConnectionBuilder OnConnectError(Action callback); } ``` Chain a call to `.OnConnectError(callback)` to your builder to register a callback to run when your connection fails. -A known bug in the SpacetimeDB Rust client SDK currently causes this callback never to be invoked. [`OnDisconnect`](#callback-ondisconnect) callbacks are invoked instead. - #### Callback `OnDisconnect` ```csharp class DbConnectionBuilder { - public DbConnectionBuilder OnDisconnect(Action callback); + public DbConnectionBuilder OnDisconnect(Action callback); } ``` @@ -187,11 +185,11 @@ Chain a call to `.OnDisconnect(callback)` to your builder to register a callback ```csharp class DbConnectionBuilder { - public DbConnectionBuilder WithToken(string token = null); + public DbConnectionBuilder WithToken(string? token); } ``` -Chain a call to `.WithToken(token)` to your builder to provide an OpenID Connect compliant JSON Web Token to authenticate with, or to explicitly select an anonymous connection. If this method is not called or `None` is passed, SpacetimeDB will generate a new `Identity` and sign a new private access token for the connection. +Chain a call to `.WithToken(token)` to your builder to provide an OpenID Connect compliant JSON Web Token to authenticate with, or to explicitly select an anonymous connection. If this method is not called or `null` is passed, SpacetimeDB will generate a new `Identity` and sign a new private access token for the connection. #### Method `Build` @@ -894,7 +892,7 @@ The `Reducers` property of the context provides access to reducers exposed by th ## Type `ErrorContext` -An `ErrorContext` is an [`IDbContext`](#interface-idbcontext) augmented with an `Event` property. `ErrorContext`s are to connections' [`OnDisconnect`](#callback-ondisconnect) and [`OnConnectError`](#callback-onconnecterror) callbacks, and to subscriptions' [`OnError`](#callback-onerror) callbacks. +An `ErrorContext` is an [`IDbContext`](#interface-idbcontext) augmented with an `Event` property. `ErrorContext`s are passed to subscriptions' [`OnError`](#callback-onerror) callbacks. | Name | Description | | ----------------------------------------- | ------------------------------------------------------ |