The .NET SDK for SurrealDB has a single SurrealDB class that provides methods for querying a remote SurrealDB database. The class is designed to be simple to use and easy to understand for developers who are new to .NET or SurrealDB. This page lists out the methods that are available in the SurrealDB class.
Method | Description |
---|---|
db.Connect() | Connects the client to the underlying endpoint, also improving performance to avoid cold starts |
db.Use(namespace, database) | Switch to a specific namespace and database |
db.Set(key, value) | Assigns a value as a parameter for this connection |
db.Unset(key) | Removes a parameter for this connection |
Method | Description |
---|---|
db.Query<T>(sql) | Runs a set of SurrealQL statements against the database |
db.RawQuery<T>(sql, vars) | Runs a set of SurrealQL statements against the database, based on a raw SurrealQL query |
db.Select<T>(thing) | Selects all records in a table, or a specific record |
db.LiveQuery<T>(sql) | Initiate a live query from a SurrealQL statement |
db.LiveRawQuery<T>(sql) | Initiate a live query from a SurrealQL statement, based on a raw SurrealQL query |
db.LiveTable<T>(table, diff) | Initiate a live query from a table |
db.ListenLive<T>(queryUuid) | Listen responses from an existing live query |
db.Kill(queryUuid) | Kill a running live query |
Method | Description |
---|---|
db.Create<T>(thing, data) | Creates a record in the database |
db.Insert<T>(thing, data) | Inserts one or multiple records in the database |
db.Update<T>(thing, data) | Updates all records in a table, or a specific record |
db.Upsert<T>(thing, data) | Creates or updates a specific record |
db.Merge<T>(thing, data) | Modifies all records in a table, or a specific record |
db.Patch<T>(thing, data) | Applies JSON Patch changes to all records in a table, or a specific record |
db.Delete(thing) | Deletes all records, or a specific record |
Method | Description |
---|---|
db.SignUp(credentials) | Signs this connection up to a specific authentication scope |
db.SignIn(credentials) | Signs this connection in to a specific authentication scope |
db.Invalidate() | Invalidates the authentication for the current connection |
db.Authenticate(token) | Authenticates the current connection with a JWT token |
db.Info<T>() | Returns the record of an authenticated scope user |