Table of Contents

TimeBasedObjectResultOptions<T> Class

Definition

Namespace
Cuemon.AspNetCore.Mvc
Assemblies
Cuemon.AspNetCore.Mvc.dll
Source
src/Cuemon.AspNetCore.Mvc/TimeBasedObjectResultOptions.cs

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.

// Program.cs
using System;
using Cuemon.AspNetCore.Mvc;

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 T was last modified, expressed as the Coordinated Universal Time (UTC).

TimestampProvider

Gets or sets the function delegate that resolves a timestamp from when the specified T was first created, expressed as the Coordinated Universal Time (UTC).

Methods

Name Description
ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.

See Also