Table of Contents

ContentBasedObjectResultOptions<T> Class

Definition

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

Specifies options that is related to the ICacheableObjectResult interface.

public class ContentBasedObjectResultOptions<T> : IContentBasedObjectResultOptions<T>, IValidatableParameterObject, IParameterObject

Type Parameters

T
Inheritance
ContentBasedObjectResultOptions<T>
Implements

Examples

The following example demonstrates how to configure to provide a checksum provider for generating ETags.

// Program.cs
using System;
using System.Security.Cryptography;
using System.Text;
using Cuemon.AspNetCore.Mvc;

var options = new ContentBasedObjectResultOptions<string>
{
    ChecksumProvider = value => SHA256.HashData(Encoding.UTF8.GetBytes(value)),
    WeakChecksumProvider = _ => false // use strong ETag
};

// Validate that the required properties are configured
options.ValidateOptions();

Console.WriteLine("ChecksumProvider is configured.");

Constructors

Name Description
ContentBasedObjectResultOptions()

Initializes a new instance of the ContentBasedObjectResultOptions<T> class.

Properties

Name Description
ChecksumProvider

Gets or sets the function delegate that resolves a checksum defining the data integrity of the specified T.

WeakChecksumProvider

Gets or sets the function delegate that resolves a value hinting whether the specified ChecksumProvider resembles a weak or a strong checksum strength.

Methods

Name Description
ValidateOptions()

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

See Also