MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / ConnectToDB

Function ConnectToDB

templates/chat-console-cs/Program.cs:43–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42/// Load credentials from a file and connect to the database.
43DbConnection ConnectToDB()
44{
45 DbConnection? conn = null;
46 conn = DbConnection.Builder()
47 .WithUri(HOST)
48 .WithDatabaseName(DB_NAME)
49 .WithToken(AuthToken.Token)
50 .OnConnect(OnConnected)
51 .OnConnectError(OnConnectError)
52 .OnDisconnect(OnDisconnected)
53 .Build();
54 return conn;
55}
56
57/// Our `OnConnect` callback: save our credentials to a file.
58void OnConnected(DbConnection conn, Identity identity, string authToken)

Callers 1

MainFunction · 0.85

Calls 8

BuildMethod · 0.45
OnDisconnectMethod · 0.45
OnConnectErrorMethod · 0.45
OnConnectMethod · 0.45
WithTokenMethod · 0.45
WithDatabaseNameMethod · 0.45
WithUriMethod · 0.45
BuilderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…