EntityTagCacheableValidator Class
Definition
- Namespace
- Cuemon.Extensions.AspNetCore.Http.Headers
- Assemblies
- Cuemon.Extensions.AspNetCore.dll
An HTTP validator that conforms to the ETag response header.
public class EntityTagCacheableValidator : ICacheableValidator
- Inheritance
-
EntityTagCacheableValidator
- Implements
- Extension Methods
Examples
The following example demonstrates how to register as a cacheable validator in the ASP.NET Core pipeline.
using System;
using Cuemon.AspNetCore.Http.Headers;
using Cuemon.Extensions.AspNetCore.Http.Headers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace DocfxExamples;
public class EntityTagCacheableValidatorExample
{
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CacheableOptions>(options =>
{
options.Validators.Add(new EntityTagCacheableValidator());
});
var serviceProvider = services.BuildServiceProvider();
var options = serviceProvider.GetRequiredService<IOptions<CacheableOptions>>();
Console.WriteLine(options.Value.Validators.Count); // 1
Console.WriteLine(options.Value.Validators[0] is EntityTagCacheableValidator); // True
}
}
Methods
| Name | Description |
|---|---|
| ProcessAsync(HttpContext, Stream) | Called asynchronously before the |