Skip to content

Entity Framework Configuration

Configure Entity Framework Core persistence for TickerQ job storage and management.

Configuration Sections

DbContext Setup

Configure which DbContext to use: built-in TickerQDbContext or your application's DbContext.

Connection & Pooling

Configure database connections, connection pooling, and schema settings.

Seeding

Initialize jobs in the database when the application starts.

Quick Example

csharp
using TickerQ.EntityFrameworkCore.DbContextFactory;

options.AddOperationalStore(efOptions =>
{
    // Use built-in TickerQDbContext
    efOptions.UseTickerQDbContext<TickerQDbContext>(optionsBuilder =>
    {
        optionsBuilder.UseNpgsql(connectionString);
    });
    
    // Configure pool size
    efOptions.SetDbContextPoolSize(34);
});

AddOperationalStore

The entry point for Entity Framework Core configuration.

Method:

csharp
// For built-in TickerQDbContext (recommended)
TickerOptionsBuilder<TTimeTicker, TCronTicker> AddOperationalStore(
    Action<TickerQEfCoreOptionBuilder<TTimeTicker, TCronTicker>> efOptions);

// For application DbContext
TickerOptionsBuilder<TTimeTicker, TCronTicker> AddOperationalStore<TDbContext>(
    Action<TickerQEfCoreOptionBuilder<TTimeTicker, TCronTicker>> efOptions)
    where TDbContext : DbContext;

See Also

Built by Albert Kunushevci