Toggly.FeatureManagement.Storage.EntityFramework 3.2.4

dotnet add package Toggly.FeatureManagement.Storage.EntityFramework --version 3.2.4
                    
NuGet\Install-Package Toggly.FeatureManagement.Storage.EntityFramework -Version 3.2.4
                    
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.2.4" />
                    
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.2.4" />
                    
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.2.4
                    
#r "nuget: Toggly.FeatureManagement.Storage.EntityFramework, 3.2.4"
                    
#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.2.4
                    
#: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.2.4
                    
Install as a Cake Addin
#tool nuget:?package=Toggly.FeatureManagement.Storage.EntityFramework&version=3.2.4
                    
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();

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.2.4 69 4/8/2026
3.2.3 61 3/24/2026
3.2.2 65 3/2/2026
3.2.1 62 3/1/2026
3.1.1 67 3/1/2026