Skip to content
DocsTry Aspire
DocsTry

AspireSurrealDbExtensions Methods

ClassMethods2 members
Provides extension methods for registering SurrealDB-related services in an Hosting.IHostApplicationBuilder.
AddKeyedSurrealClient(IHostApplicationBuilder, string, Action<SurrealDbClientSettings>)Section titled AddKeyedSurrealClient(IHostApplicationBuilder, string, Action<SurrealDbClientSettings>)extension
Registers Net.SurrealDbClient as a keyed service for the given name in the services provided by the builder.
public static class AspireSurrealDbExtensions
{
public static void AddKeyedSurrealClient(
this IHostApplicationBuilder builder,
string name,
Action<SurrealDbClientSettings>? configureSettings = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
namestringThe connection name to use to find a connection string.
configureSettingsAction<SurrealDbClientSettings>optionalAn optional method that can be used for customizing the SurrealDbClientSettings. It's invoked after the settings are read from the configuration.
InvalidOperationExceptionIf required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Surreal:Client" section.
AddSurrealClient(IHostApplicationBuilder, string, Action<SurrealDbClientSettings>)Section titled AddSurrealClient(IHostApplicationBuilder, string, Action<SurrealDbClientSettings>)extension
Registers Net.SurrealDbClient in the services provided by the builder.
public static class AspireSurrealDbExtensions
{
public static void AddSurrealClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<SurrealDbClientSettings>? configureSettings = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringThe connection name to use to find a connection string.
configureSettingsAction<SurrealDbClientSettings>optionalAn optional method that can be used for customizing the SurrealDbClientSettings. It's invoked after the settings are read from the configuration.
InvalidOperationExceptionIf required ConnectionString is not provided in configuration section
Reads the configuration from "Aspire:Surreal:Client" section.