Skip to content
DocsTry Aspire
DocsTry

AspireDuckDBExtensions Methods

ClassMethods2 members
Provides extension methods for registering DuckDB-related services in an Hosting.IHostApplicationBuilder.
AddDuckDBConnection(IHostApplicationBuilder, string, Action<DuckDBConnectionSettings>)Section titled AddDuckDBConnection(IHostApplicationBuilder, string, Action<DuckDBConnectionSettings>)extension
Registers Data.DuckDBConnection as scoped in the services provided by the builder.
public static class AspireDuckDBExtensions
{
public static void AddDuckDBConnection(
this IHostApplicationBuilder builder,
string name,
Action<DuckDBConnectionSettings>? configureSettings = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
namestringThe connection name to use to find a connection string.
configureSettingsAction<DuckDBConnectionSettings>optionalAn optional method that can be used for customizing the DuckDBConnectionSettings. 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:DuckDB:Client" section.
AddKeyedDuckDBConnection(IHostApplicationBuilder, string, Action<DuckDBConnectionSettings>)Section titled AddKeyedDuckDBConnection(IHostApplicationBuilder, string, Action<DuckDBConnectionSettings>)extension
Registers Data.DuckDBConnection as keyed scoped for the given name in the services provided by the builder.
public static class AspireDuckDBExtensions
{
public static void AddKeyedDuckDBConnection(
this IHostApplicationBuilder builder,
string name,
Action<DuckDBConnectionSettings>? configureSettings = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
namestringThe connection name to use to find a connection string.
configureSettingsAction<DuckDBConnectionSettings>optionalAn optional method that can be used for customizing the DuckDBConnectionSettings. 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:DuckDB:Client" section.