TimeBasedObjectResultOptions<T> Class
Definition
- Namespace
- Cuemon.AspNetCore.Mvc
- Assemblies
- Cuemon.AspNetCore.Mvc.dll
Specifies options that is related to the ICacheableObjectResult interface.
public class TimeBasedObjectResultOptions<T> : ITimeBasedObjectResultOptions<T>, IValidatableParameterObject, IParameterObject
Type Parameters
T
- Inheritance
-
TimeBasedObjectResultOptions<T>
- Implements
Examples
The following example demonstrates how to configure to provide timestamp providers for generating Last-Modified headers.
using System;
using Cuemon.AspNetCore.Mvc;
namespace MyApp.Examples;
public class TimeBasedObjectResultOptionsExample
{
public void Demonstrate()
{
var options = new TimeBasedObjectResultOptions<DateTime>
{
TimestampProvider = value => value,
ChangedTimestampProvider = value => value.AddHours(1)
};
// Validate that the required properties are configured
options.ValidateOptions();
var created = new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc);
Console.WriteLine($"Created: {options.TimestampProvider(created)}");
Console.WriteLine($"Modified: {options.ChangedTimestampProvider(created)}");
}
}
Constructors
| Name | Description |
|---|---|
| TimeBasedObjectResultOptions() | Initializes a new instance of the TimeBasedObjectResultOptions<T> class. |
Properties
| Name | Description |
|---|---|
| ChangedTimestampProvider | Gets or sets the function delegate that resolves a timestamp from when the specified |
| TimestampProvider | Gets or sets the function delegate that resolves a timestamp from when the specified |
Methods
| Name | Description |
|---|---|
| ValidateOptions() | Determines whether the public read-write properties of this instance are in a valid state. |