Toggly.FeatureManagement.Storage.Dapper 3.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Toggly.FeatureManagement.Storage.Dapper --version 3.2.1
                    
NuGet\Install-Package Toggly.FeatureManagement.Storage.Dapper -Version 3.2.1
                    
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.Dapper" Version="3.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Toggly.FeatureManagement.Storage.Dapper" Version="3.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Toggly.FeatureManagement.Storage.Dapper" />
                    
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.Dapper --version 3.2.1
                    
#r "nuget: Toggly.FeatureManagement.Storage.Dapper, 3.2.1"
                    
#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.Dapper@3.2.1
                    
#: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.Dapper&version=3.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Toggly.FeatureManagement.Storage.Dapper&version=3.2.1
                    
Install as a Cake Tool

Toggly Dapper Snapshot Provider

Lightweight, high-performance Dapper-based snapshot provider for Toggly Feature Management. Stores feature flag snapshots in SQL databases using raw SQL queries for optimal performance.

Installation

dotnet add package Toggly.FeatureManagement.Storage.Dapper

You'll also need to install the appropriate ADO.NET provider for your database:

# SQL Server
dotnet add package Microsoft.Data.SqlClient

# PostgreSQL
dotnet add package Npgsql

# MySQL
dotnet add package MySqlConnector

# SQLite
dotnet add package Microsoft.Data.Sqlite

Usage

SQL Server

using Toggly.FeatureManagement.Storage.Dapper.Configuration;
using Microsoft.Data.SqlClient;

services.AddTogglyDapperSnapshotProvider(
    () => new SqlConnection(Configuration.GetConnectionString("DefaultConnection")),
    options => options.Provider = DatabaseProvider.SqlServer
);

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

PostgreSQL

using Npgsql;

services.AddTogglyDapperSnapshotProvider(
    () => new NpgsqlConnection(Configuration.GetConnectionString("PostgresConnection")),
    options => options.Provider = DatabaseProvider.PostgreSql
);

MySQL

using MySqlConnector;

services.AddTogglyDapperSnapshotProvider(
    () => new MySqlConnection(Configuration.GetConnectionString("MySqlConnection")),
    options => options.Provider = DatabaseProvider.MySql
);

SQLite

using Microsoft.Data.Sqlite;

services.AddTogglyDapperSnapshotProvider(
    () => new SqliteConnection("Data Source=toggly.db"),
    options => options.Provider = DatabaseProvider.Sqlite
);

With Custom Settings

services.AddTogglyDapperSnapshotProvider(
    () => new SqlConnection(connectionString),
    options => {
        options.Provider = DatabaseProvider.SqlServer;
        options.TableName = "MyFeatureSnapshots";    // Default: "TogglySnapshots"
        options.DocumentName = "my_features";        // Default: "toggly_features"
        options.JwkDocumentName = "my_jwks";         // Default: "toggly_jwks"
        options.AutoCreateTable = true;              // Default: true
    }
);

Using Existing Connection Factory

If you've already registered a connection factory:

// Register connection factory separately
services.AddSingleton<Func<IDbConnection>>(() =>
    new SqlConnection(Configuration.GetConnectionString("DefaultConnection"))
);

// Then just add the snapshot provider
services.AddTogglyDapperSnapshotProvider(
    options => options.Provider = DatabaseProvider.SqlServer
);

Table Schema

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

Column Type Description
Id VARCHAR(100) Primary key (document name)
Data TEXT/NVARCHAR(MAX) 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

Manual Table Creation

If you prefer to create the table manually, here are the scripts for each database:

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 DEFAULT GETUTCDATE()
);
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 DEFAULT CURRENT_TIMESTAMP
);
MySQL
CREATE TABLE `TogglySnapshots` (
    `Id` VARCHAR(100) NOT NULL PRIMARY KEY,
    `Data` LONGTEXT NOT NULL,
    `Signature` VARCHAR(1000) NULL,
    `KeyId` VARCHAR(100) NULL,
    `Timestamp` BIGINT NULL,
    `UpdatedAt` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
SQLite
CREATE TABLE "TogglySnapshots" (
    "Id" TEXT NOT NULL PRIMARY KEY,
    "Data" TEXT NOT NULL,
    "Signature" TEXT NULL,
    "KeyId" TEXT NULL,
    "Timestamp" INTEGER NULL,
    "UpdatedAt" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
);

Configuration Options

Option Type Default Description
Provider DatabaseProvider SqlServer Database type for SQL dialect
TableName string "TogglySnapshots" Name of the snapshots table
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

Supported Databases

Database Enum Value Tested Versions
SQL Server DatabaseProvider.SqlServer 2016+
PostgreSQL DatabaseProvider.PostgreSql 12+
MySQL/MariaDB DatabaseProvider.MySql 5.7+/10.3+
SQLite DatabaseProvider.Sqlite 3.x

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 102 4/8/2026
3.2.3 99 3/24/2026
3.2.2 101 3/2/2026
3.2.1 95 3/1/2026
3.1.1 101 3/1/2026