Skip to content

Entity Framework Setup

Configure Entity Framework Core persistence for TickerQ. Choose the setup approach that best fits your application architecture.

Setup Options

Built-in TickerQDbContext

Use the lightweight, optimized TickerQDbContext designed specifically for TickerQ. Recommended for most scenarios.

Application DbContext

Integrate TickerQ entities into your existing application DbContext for shared database connections and unified migrations.

Custom Entity Types

Create custom entity types with additional properties, then configure TickerQ to use them.

Quick Comparison

FeatureTickerQDbContextApplication DbContextCustom Entities
Setup ComplexitySimpleModerateMore complex
Connection SharingSeparateShared poolConfigurable
Entity MixingIsolatedMixedCustom
MigrationsSeparateCombinedSeparate
Recommended ForMost scenariosWhen integration neededMulti-tenancy, custom properties

Common Setup Pattern

Most applications should use the built-in TickerQDbContext:

csharp
using TickerQ.EntityFrameworkCore.DbContextFactory;

builder.Services.AddTickerQ(options =>
{
    options.AddOperationalStore(efOptions =>
    {
        efOptions.UseTickerQDbContext<TickerQDbContext>(optionsBuilder =>
        {
            optionsBuilder.UseNpgsql(connectionString);
        });
        efOptions.SetDbContextPoolSize(34);
    });
});

See Also

Built by Albert Kunushevci