Table of Contents

AssemblyCacheBusting Class

Definition

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

Name Description
AssemblyCacheBusting(IOptions<AssemblyCacheBustingOptions>)

Initializes a new instance of the AssemblyCacheBusting class.

Properties

Name Description
Version

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

See Also