ThrottlingTroll.CounterStores.EfCore
7.2.0-beta1
See the version list below for details.
dotnet add package ThrottlingTroll.CounterStores.EfCore --version 7.2.0-beta1
NuGet\Install-Package ThrottlingTroll.CounterStores.EfCore -Version 7.2.0-beta1
<PackageReference Include="ThrottlingTroll.CounterStores.EfCore" Version="7.2.0-beta1" />
paket add ThrottlingTroll.CounterStores.EfCore --version 7.2.0-beta1
#r "nuget: ThrottlingTroll.CounterStores.EfCore, 7.2.0-beta1"
// Install ThrottlingTroll.CounterStores.EfCore as a Cake Addin #addin nuget:?package=ThrottlingTroll.CounterStores.EfCore&version=7.2.0-beta1&prerelease // Install ThrottlingTroll.CounterStores.EfCore as a Cake Tool #tool nuget:?package=ThrottlingTroll.CounterStores.EfCore&version=7.2.0-beta1&prerelease
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.EfCore
Install the desired database provider. E.g. for SQL Server:
dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 6.0.31
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 | Versions 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 was computed. 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. |
-
net6.0
- Microsoft.EntityFrameworkCore.Relational (>= 6.0.31)
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 |
---|---|---|
7.3.0 | 83 | 10/14/2024 |
7.2.0 | 98 | 8/31/2024 |
7.2.0-beta1 | 79 | 8/31/2024 |
7.1.2 | 98 | 6/12/2024 |
7.1.1 | 88 | 6/3/2024 |
7.1.0 | 106 | 6/1/2024 |
7.1.0-beta1 | 98 | 6/1/2024 |