ThrottlingTroll.CounterStores.EfCore 7.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ThrottlingTroll.CounterStores.EfCore --version 7.1.1                
NuGet\Install-Package ThrottlingTroll.CounterStores.EfCore -Version 7.1.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="ThrottlingTroll.CounterStores.EfCore" Version="7.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ThrottlingTroll.CounterStores.EfCore --version 7.1.1                
#r "nuget: ThrottlingTroll.CounterStores.EfCore, 7.1.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.
// Install ThrottlingTroll.CounterStores.EfCore as a Cake Addin
#addin nuget:?package=ThrottlingTroll.CounterStores.EfCore&version=7.1.1

// Install ThrottlingTroll.CounterStores.EfCore as a Cake Tool
#tool nuget:?package=ThrottlingTroll.CounterStores.EfCore&version=7.1.1                

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 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. 
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
7.3.0 85 10/14/2024
7.2.0 100 8/31/2024
7.2.0-beta1 81 8/31/2024
7.1.2 100 6/12/2024
7.1.1 90 6/3/2024
7.1.0 108 6/1/2024
7.1.0-beta1 100 6/1/2024