AspireEFSqliteExtensions Methods
Class Methods 2 members
Extension methods for configuring Sqlite with Entity Framework Core.
AddSqliteDbContext(IHostApplicationBuilder, string, Action<SqliteEntityFrameworkCoreSettings>, Action<DbContextOptionsBuilder>) Section titled AddSqliteDbContext(IHostApplicationBuilder, string, Action<SqliteEntityFrameworkCoreSettings>, Action<DbContextOptionsBuilder>) static Registers the as a scoped service in the services provided by the .
public static class AspireEFSqliteExtensions{ void AddSqliteDbContext<TContext>( IHostApplicationBuilder builder, string name, Action<SqliteEntityFrameworkCoreSettings>? configureSettings = null, Action<DbContextOptionsBuilder>? configureDbContextOptions = null) { // ... }}Parameters
builder IHostApplicationBuilder The to read config from and add services to. name string A name used to retrieve the connection string from the ConnectionStrings configuration section. configureSettings Action<SqliteEntityFrameworkCoreSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration. configureDbContextOptions Action<DbContextOptionsBuilder> optional An optional method that can be used for customizing the . Exceptions
ArgumentNullException Thrown if mandatory is null. InvalidOperationException Thrown when mandatory is not provided. Remarks
Reads the configuration from "Aspire:Sqlite:EntityFrameworkCore:Sqlite:{typeof(TContext).Name}" config section, or "Aspire:Sqlite:EntityFrameworkCore:Sqlite" if former does not exist. The method can then be overridden to configure options.
EnrichSqliteDatabaseDbContext(IHostApplicationBuilder, Action<SqliteEntityFrameworkCoreSettings>) Section titled EnrichSqliteDatabaseDbContext(IHostApplicationBuilder, Action<SqliteEntityFrameworkCoreSettings>) static Enriches a to register the as a scoped service with simplified configuration and optional OpenTelemetry instrumentation.
public static class AspireEFSqliteExtensions{ void EnrichSqliteDatabaseDbContext<TDbContext>( IHostApplicationBuilder builder, Action<SqliteEntityFrameworkCoreSettings>? configureSettings = null) { // ... }}Parameters
builder IHostApplicationBuilder The to read config from and add services to. configureSettings Action<SqliteEntityFrameworkCoreSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration. Exceptions
ArgumentNullException Thrown if mandatory is null.