ThrottlingTroll.CounterStores.EfCore 11.0.0

dotnet add package ThrottlingTroll.CounterStores.EfCore --version 11.0.0
                    
NuGet\Install-Package ThrottlingTroll.CounterStores.EfCore -Version 11.0.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="ThrottlingTroll.CounterStores.EfCore" Version="11.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ThrottlingTroll.CounterStores.EfCore" Version="11.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ThrottlingTroll.CounterStores.EfCore" />
                    
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 ThrottlingTroll.CounterStores.EfCore --version 11.0.0
                    
#r "nuget: ThrottlingTroll.CounterStores.EfCore, 11.0.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 ThrottlingTroll.CounterStores.EfCore@11.0.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=ThrottlingTroll.CounterStores.EfCore&version=11.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ThrottlingTroll.CounterStores.EfCore&version=11.0.0
                    
Install as a Cake Tool

ThrottlingTroll.CounterStores.EfCore

ICounterStore implementation based on Entity Framework Core. Intended to work with any relational database supported by it.

Uses transactions, and therefore is subjected to locks. Use with caution, especially under high loads.

How to use

  1. Create a table for storing counters:

     CREATE TABLE ThrottlingTrollCounters
     (
       [Id] [nvarchar](255) PRIMARY KEY,
       [Count] [bigint] NOT NULL,
       [ExpiresAt] [datetimeoffset] NOT NULL
     )    
    
  2. Install package from NuGet:

      dotnet add package ThrottlingTroll.CounterStores.EfCore
    
  3. Install the desired database provider. E.g. for SQL Server:

      dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 6.0.31
    
  4. EITHER put EfCoreCounterStore instance into your DI container:

      builder.Services.AddSingleton<ICounterStore>(
          new EfCoreCounterStore(efConfig =>
          {
              efConfig.UseSqlServer("my-sql-server-connection-string");
          })
      );
    

    OR provide an instance of it via .UseThrottlingTroll() method:

      app.UseThrottlingTroll(options =>
      {
          options.CounterStore = new EfCoreCounterStore(efConfig =>
          {
              efConfig.UseSqlServer("my-sql-server-connection-string");
          });
      });
    

EfCoreCounterStore's ctor takes a routine for configuring Entity Framework Core with the desired database provider. The above sample code uses SQL Server, so change it accordingly, if needed.

Product Compatible and additional computed target framework versions.
.NET 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
11.0.0 102 11/4/2026
11.0.0-beta3 87 11/4/2026
11.0.0-beta2 89 11/3/2026
11.0.0-beta1 99 11/2/2026
10.0.1 187 3/30/2026
10.0.0 216 3/7/2026
10.0.0-beta3 137 3/6/2026
10.0.0-beta2 141 3/3/2026
10.0.0-beta1 135 3/1/2026
9.2.0 156 2/1/2026
9.1.0 166 1/7/2026
9.0.0 241 12/23/2025
9.0.0-beta3 221 12/22/2025
9.0.0-beta2 215 12/22/2025
9.0.0-beta1 201 12/21/2025
8.0.0 284 7/1/2025
8.0.0-beta3 237 6/30/2025
8.0.0-beta2 233 6/29/2025
8.0.0-beta1 178 6/28/2025
7.3.0 770 10/14/2024
Loading failed