Skip to content

Commit 113e8dd

Browse files
authored
Add DbConnection argument to OnConnect (#138)
## Description of Changes *Describe what has been changed, any new features or bug fixes* ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs *List any PRs here that are required for this SDK change to work*
1 parent 87a13eb commit 113e8dd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

sdks/csharp/examples~/quickstart/client/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ void Main()
2626
.WithUri(HOST)
2727
.WithModuleName(DBNAME)
2828
//.WithCredentials((null, AuthToken.Token))
29-
// TODO: change this to just `(OnConnect)` when signature is fixed in #131.
30-
.OnConnect((identity, authToken) => OnConnect(conn!, identity, authToken))
29+
.OnConnect(OnConnect)
3130
.OnConnectError(OnConnectError)
3231
.OnDisconnect(OnDisconnect)
3332
.Build();

sdks/csharp/src/SpacetimeDBClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public DbConnectionBuilder<DbConnection, Reducer> WithCredentials(in (Identity i
5858
return this;
5959
}
6060

61-
public DbConnectionBuilder<DbConnection, Reducer> OnConnect(Action<Identity, string> cb)
61+
public DbConnectionBuilder<DbConnection, Reducer> OnConnect(Action<DbConnection, Identity, string> cb)
6262
{
63-
conn.onConnect += cb;
63+
conn.onConnect += (identity, token) => cb.Invoke(conn, identity, token);
6464
return this;
6565
}
6666

0 commit comments

Comments
 (0)