Table of Contents

Class AssemblyCacheBusting

Namespace
Cuemon.Extensions.AspNetCore.Configuration
Assembly
Cuemon.Extensions.AspNetCore.dll

Provides cache-busting capabilities from an Assembly. This class cannot be inherited.

public sealed class AssemblyCacheBusting : CacheBusting, ICacheBusting
Inheritance
AssemblyCacheBusting
Implements
Extension Methods

Examples

The following example demonstrates how to create an AssemblyCacheBusting instance to provide cache-busting version strings derived from the entry assembly.

using System;
using Cuemon.Extensions.AspNetCore.Configuration;
using Cuemon.Security.Cryptography;
using Microsoft.Extensions.Options;

namespace MyApp.Examples;

public class AssemblyCacheBustingExample
{
    public void Demonstrate()
    {
        var options = Options.Create(new AssemblyCacheBustingOptions
        {
            Algorithm = UnkeyedCryptoAlgorithm.Sha256,
            ReadByteForByteChecksum = true
        });

        var cacheBusting = new AssemblyCacheBusting(options);
        string version = cacheBusting.Version;

        Console.WriteLine($"Cache-busting version: {version}");

}
}

Constructors

AssemblyCacheBusting(IOptions<AssemblyCacheBustingOptions>)

Initializes a new instance of the AssemblyCacheBusting class.

public AssemblyCacheBusting(IOptions<AssemblyCacheBustingOptions> setup)

Parameters

setup IOptions<AssemblyCacheBustingOptions>

The AssemblyCacheBustingOptions which need to be configured.

Properties

Version

Gets the version to be a part of the link you need cache-busting compatible.

public override string Version { get; }

Property Value

string

The version to be a part of the link you need cache-busting compatible.

See Also