[API Proposal]: Make RateLimitPartition.Factory public #70597
Labels
api-approved
API was approved in API review, it can be implemented
area-System.Threading
blocking
Marks issues that we want to fast track in order to unblock other important work
Background and motivation
This will allow aspnetcore's
RateLimitingMiddleware
to resolve aLimiter
from a givenTKey
without having to use reflection. The use case is that users provide aFunc<HttpContext, RateLimitPartition<TKey>>
, which we want to convert to aFunc<HttpContext, RateLimitPartition<AspNetKey<TKey>>>
(usingFactory
) -AspNetKey
being used to remove possible ambiguities between TKeys.API Proposal
namespace System.Threading.RateLimiting { public struct RateLimitPartition<TKey> { public RateLimitPartition(TKey partitionKey, Func<TKey, RateLimiter> factory) public TKey PartitionKey { get; } + public Func<TKey, RateLimiter> Factory {get; } }
API Usage
Alternative Designs
The other option is to use private reflection
Risks
N/A?
The text was updated successfully, but these errors were encountered: