All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated
twerner's Avatar

twerner / ASP.NET Core Rate Limiting

0 likes
0 forks
2 files
Last active 1 year ago
1 // Existing services ...
2
3 builder.Services.AddRateLimiter(options =>
4 {
5 options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext =>
6 RateLimitPartition.GetFixedWindowLimiter(
7 partitionKey: httpContext.User.Identity?.Name ?? httpContext.Request.Headers.Host.ToString(),
8 factory: partition => new FixedWindowRateLimiterOptions
9 {
10 AutoReplenishment = true,
twerner's Avatar

twerner / GenericRepository

0 likes
0 forks
6 files
Last active 1 year ago
1 public class GenericRepository<T, TKey> : IGenericRepository<T, TKey>
2 where T : class
3 where TKey : IEquatable<TKey>
4 {
5 protected readonly ApplicationDbContext Context;
6 protected readonly IMapper Mapper;
7
8 protected GenericRepository(ApplicationDbContext context, IMapper mapper)
9 {
10 Context = context;
Newer Older

Powered by Opengist ⋅ Load: 36ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文