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
<PackageReference Include="ThrottlingTroll.CounterStores.EfCore" Version="11.0.0" />
<PackageVersion Include="ThrottlingTroll.CounterStores.EfCore" Version="11.0.0" />
<PackageReference Include="ThrottlingTroll.CounterStores.EfCore" />
paket add ThrottlingTroll.CounterStores.EfCore --version 11.0.0
#r "nuget: ThrottlingTroll.CounterStores.EfCore, 11.0.0"
#:package ThrottlingTroll.CounterStores.EfCore@11.0.0
#addin nuget:?package=ThrottlingTroll.CounterStores.EfCore&version=11.0.0
#tool nuget:?package=ThrottlingTroll.CounterStores.EfCore&version=11.0.0
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
Create a table for storing counters:
CREATE TABLE ThrottlingTrollCounters ( [Id] [nvarchar](255) PRIMARY KEY, [Count] [bigint] NOT NULL, [ExpiresAt] [datetimeoffset] NOT NULL )Install package from NuGet:
dotnet add package ThrottlingTroll.CounterStores.EfCoreInstall the desired database provider. E.g. for SQL Server:
dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 6.0.31EITHER 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 | Versions 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. |
-
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.14)
- Microsoft.Extensions.Caching.Memory (>= 10.0.14)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.14)
- Microsoft.Extensions.Http (>= 10.0.14)
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 |