Toggly.FeatureManagement.Storage.EntityFramework 3.7.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Toggly.FeatureManagement.Storage.EntityFramework --version 3.7.0
                    
NuGet\Install-Package Toggly.FeatureManagement.Storage.EntityFramework -Version 3.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Toggly.FeatureManagement.Storage.EntityFramework" Version="3.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Toggly.FeatureManagement.Storage.EntityFramework" Version="3.7.0" />
                    
Directory.Packages.props
<PackageReference Include="Toggly.FeatureManagement.Storage.EntityFramework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Toggly.FeatureManagement.Storage.EntityFramework --version 3.7.0
                    
#r "nuget: Toggly.FeatureManagement.Storage.EntityFramework, 3.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Toggly.FeatureManagement.Storage.EntityFramework@3.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Toggly.FeatureManagement.Storage.EntityFramework&version=3.7.0
                    
Install as a Cake Addin
#tool nuget:?package=Toggly.FeatureManagement.Storage.EntityFramework&version=3.7.0
                    
Install as a Cake Tool

Toggly Entity Framework Snapshot Provider

Entity Framework Core snapshot provider for Toggly Feature Management. Stores feature flag snapshots in any database supported by Entity Framework Core (SQL Server, PostgreSQL, MySQL, SQLite, etc.).

Installation

dotnet add package Toggly.FeatureManagement.Storage.EntityFramework

You'll also need to install the appropriate EF Core database provider for your database:

# SQL Server
dotnet add package Microsoft.EntityFrameworkCore.SqlServer

# PostgreSQL
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL

# MySQL
dotnet add package Pomelo.EntityFrameworkCore.MySql

# SQLite
dotnet add package Microsoft.EntityFrameworkCore.Sqlite

Usage

Basic Setup

using Toggly.FeatureManagement.Storage.EntityFramework.Configuration;

// In Program.cs or Startup.cs
services.AddTogglyEntityFrameworkSnapshotProvider(
    options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))
);

// Then configure Toggly as usual
services.AddTogglyFeatureManagement(options => {
    options.AppKey = "your-app-key";
    options.Environment = "production";
});

With Custom Settings

services.AddTogglyEntityFrameworkSnapshotProvider(
    options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")),
    settings => {
        settings.DocumentName = "my_features";      // Default: "toggly_features"
        settings.JwkDocumentName = "my_jwks";       // Default: "toggly_jwks"
        settings.AutoCreateTable = true;            // Default: true
    }
);

With Existing DbContext Registration

If you've already registered TogglyEntities in your DI container:

// Register the DbContext separately
services.AddDbContext<TogglyEntities>(options =>
    options.UseNpgsql(Configuration.GetConnectionString("PostgresConnection"))
);

// Then just add the snapshot provider
services.AddTogglyEntityFrameworkSnapshotProvider();

Embedded catalog store

The embedded dashboard stores its editable, authoritative catalog separately from cloud-definition snapshots. Register it with its own database options:

using Toggly.FeatureManagement.Storage.EntityFramework.Configuration;

services.AddTogglyEntityFrameworkCatalogStore(options =>
    options.UseSqlite("Data Source=toggly.db"));

The registration uses IDbContextFactory<TogglyCatalogDbContext> and opens one context per read or write. It never calls EnsureCreated() and never changes TogglySnapshots; create the dedicated TogglyCatalogs table as part of application provisioning.

The package includes creation scripts for SQLite, SQL Server, and PostgreSQL in its schema package folder:

  • TogglyCatalogs.sqlite.sql
  • TogglyCatalogs.sqlserver.sql
  • TogglyCatalogs.postgresql.sql

For the SQLite sample application only, it is acceptable to call EnsureCreatedAsync() on TogglyCatalogDbContext during explicit sample setup. Production applications should apply the matching catalog-only script or an equivalent migration before serving requests.

Each persisted catalog has an application-generated revision token. TryWriteAsync creates only when the expected revision is null; later writes must submit the revision returned by the preceding read or write. Concurrent updates return a conflict and the current stored catalog. The catalog name is retained verbatim, while its SHA-256 digest is used as the table key.

Database Examples

SQL Server
services.AddTogglyEntityFrameworkSnapshotProvider(
    options => options.UseSqlServer("Server=localhost;Database=MyApp;Trusted_Connection=True;")
);
PostgreSQL
services.AddTogglyEntityFrameworkSnapshotProvider(
    options => options.UseNpgsql("Host=localhost;Database=myapp;Username=user;Password=pass")
);
SQLite
services.AddTogglyEntityFrameworkSnapshotProvider(
    options => options.UseSqlite("Data Source=toggly.db")
);
MySQL
services.AddTogglyEntityFrameworkSnapshotProvider(
    options => options.UseMySql(
        "Server=localhost;Database=myapp;User=user;Password=pass;",
        ServerVersion.AutoDetect(connectionString)
    )
);

Table Schema

The provider creates a single table TogglySnapshots with the following schema:

Column Type Description
Id VARCHAR(100) Primary key (document name)
Data TEXT JSON serialized snapshot data
Signature VARCHAR(1000) Signature for signed definitions
KeyId VARCHAR(100) Key ID for signature verification
Timestamp BIGINT Unix timestamp of the snapshot
UpdatedAt DATETIME Last update time

Auto Table Creation

By default, the provider will automatically create the table if it doesn't exist when AutoCreateTable is set to true (default).

If you prefer to manage database schema yourself, set AutoCreateTable = false and run the appropriate migration:

-- SQL Server
CREATE TABLE TogglySnapshots (
    Id NVARCHAR(100) NOT NULL PRIMARY KEY,
    Data NVARCHAR(MAX) NOT NULL,
    Signature NVARCHAR(1000) NULL,
    KeyId NVARCHAR(100) NULL,
    Timestamp BIGINT NULL,
    UpdatedAt DATETIME2 NOT NULL
);

-- PostgreSQL
CREATE TABLE "TogglySnapshots" (
    "Id" VARCHAR(100) NOT NULL PRIMARY KEY,
    "Data" TEXT NOT NULL,
    "Signature" VARCHAR(1000) NULL,
    "KeyId" VARCHAR(100) NULL,
    "Timestamp" BIGINT NULL,
    "UpdatedAt" TIMESTAMP NOT NULL
);

Configuration Options

Option Type Default Description
DocumentName string "toggly_features" ID for the feature snapshot document
JwkDocumentName string "toggly_jwks" ID for the JWK snapshot document
AutoCreateTable bool true Automatically create table if it doesn't exist

License

MIT License - see LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.8.0 31 9/15/2026
3.7.0 65 9/14/2026
3.6.6 65 9/8/2026
3.6.5 73 9/7/2026
3.6.3 67 9/6/2026
3.6.1 69 9/4/2026
3.6.0 65 9/3/2026
3.5.0 67 8/21/2026
3.4.1 73 8/10/2026
3.4.0 93 7/14/2026
3.3.0 75 7/12/2026
3.2.4 99 4/8/2026
3.2.3 85 3/24/2026
3.2.2 91 3/2/2026
3.2.1 82 3/1/2026
3.1.1 90 3/1/2026