diff --git a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/HCMinimal.csproj b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/HCMinimal.csproj index 194f6af2695c..9a6b8e185674 100644 --- a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/HCMinimal.csproj +++ b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/HCMinimal.csproj @@ -7,7 +7,7 @@ - + diff --git a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/Program.cs b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/Program.cs index 799bde57f6d1..c27007f016f7 100644 --- a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/Program.cs +++ b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal/Program.cs @@ -52,11 +52,8 @@ public static void Main(string[] args) app.UseAuthorization(); - app.MapGet("/{name}/{ID}", async (context) => + app.MapGet("/{name}/{ID}", async (HttpContext context, string? name, Int32 ID) => { - string? name = context.Request.RouteValues["name"] as string; - int ID = Convert.ToInt32(context.Request.RouteValues["ID"]); - var someService = context.RequestServices.GetRequiredService(); var someInfo = await someService.GetSomeInfoAsync(name!, ID); context.Response.StatusCode = 200; @@ -79,7 +76,7 @@ public async Task GetSomeInfoAsync(string name, int id, CancellationToke return await _cache.GetOrCreateAsync( $"{name}-{id}", // Unique key to the cache entry async cancel => await GetDataFromTheSourceAsync(name, id, cancel), - token: token + cancellationToken: token ); } @@ -110,7 +107,7 @@ public async Task GetSomeInfoAsync(string name, int id, CancellationToke async cancel => await GetDataFromTheSourceAsync(name, id, cancel), entryOptions, tags, - token: token + cancellationToken: token ); } @@ -135,7 +132,7 @@ public async Task GetSomeInfoAsync(string name, int id, CancellationToke (name, id, obj: this), static async (state, token) => await state.obj.GetDataFromTheSourceAsync(state.name, state.id, token), - token: token + cancellationToken: token ); } diff --git a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/HCMinimal.csproj b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/HCMinimal.csproj index 6bd1fba7670e..1c7c988784d4 100644 --- a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/HCMinimal.csproj +++ b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/HCMinimal.csproj @@ -22,10 +22,10 @@ - - - - + + + + diff --git a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/Program.cs b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/Program.cs index ba73767af74d..1402f960a5f4 100644 --- a/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/Program.cs +++ b/aspnetcore/performance/caching/hybrid/samples/9.x/HCMinimal2/Program.cs @@ -76,10 +76,8 @@ public static void Main(string[] args) app.UseAuthorization(); - app.MapGet("/{ID}", async (context) => + app.MapGet("/{ID}", async (HttpContext context, Int32 ID) => { - int ID = Convert.ToInt32(context.Request.RouteValues["ID"]); - var someService = context.RequestServices.GetRequiredService(); var someProtobufMessage = await someService.GetSomeProtobufMessageFromCacheAsync(ID); var someMessage = await someService.GetSomeMessageFromCacheAsync(ID); @@ -138,7 +136,7 @@ public async Task return await _cache.GetOrCreateAsync( $"SomeMessage_{id}", // Unique key to the cache entry async cancel => await GetSomeMessageFromSourceAsync(id, token), - token: token + cancellationToken: token ); } @@ -148,7 +146,7 @@ public async Task return await _cache.GetOrCreateAsync( $"Protobuf_{id}", // Unique key to the cache entry async cancel => await GetSomeProtobufMessageFromSourceAsync(id, token), - token: token + cancellationToken: token ); }