Overview
Cuemon.Extensions.Data.Integrity adds extension methods on top of Cuemon.Data.Integrity so callers can create or enrich CacheValidator instances from values they already have, including Assembly, FileInfo, DateTime, and existing ChecksumBuilder instances. It removes most of the manual EntityInfo construction and checksum decorator plumbing from call sites.
The package does not introduce a new integrity model. It packages common validator creation patterns around the lower-level Cuemon.Data.Integrity types and keeps checksum composition fluent when a builder needs extra identity data.
Key APIs
AssemblyExtensions.GetCacheValidator creates a CacheValidator from an Assembly. For file-backed assemblies it reuses file-based validation and then combines the assembly full-name hash so the result reflects both the binary and the assembly identity.
FileInfoExtensions.GetCacheValidator converts file metadata into a CacheValidator by delegating to CacheValidatorFactory.CreateValidator. The optional setup callback lets callers tune FileChecksumOptions, and any file-processing failure falls back to CacheValidator.Default.
DateTimeExtensions.GetCacheValidator turns created and modified timestamps into a validator without forcing you to construct EntityInfo directly. The checksum-aware overload also lets you attach a precomputed digest and explicitly mark it as weak or strong validation.
ChecksumBuilderExtensions.CombineWith<T> adds strongly typed overloads for numeric values, strings, and byte arrays while preserving the concrete ChecksumBuilder subtype. It is the package-owned shortcut over the lower-level decorator-based combine operations in Cuemon.Data.Integrity.
Basic usage
using Cuemon.Data.Integrity;
using Cuemon.Extensions.Data.Integrity;
using Codebelt.Extensions.Xunit;
using Xunit;
namespace MyProject.Tests;
public class AssemblyCacheValidatorTest : Test
{
public AssemblyCacheValidatorTest(ITestOutputHelper output) : base(output)
{
}
[Fact]
public void ShouldCreateWeakValidatorForCurrentAssembly()
{
var assembly = typeof(AssemblyCacheValidatorTest).Assembly;
var validator = assembly.GetCacheValidator();
Assert.Equal(EntityDataIntegrityValidation.Weak, validator.Validation);
Assert.NotEqual(CacheValidator.Default.ToString(), validator.ToString());
TestOutput.WriteLine($"Assembly validator: {validator}");
}
}
Use this pattern when an assembly already represents the versioned artifact you need to fingerprint for cache validation or deployment-aware responses. It matters because the extension combines assembly identity with file-backed integrity data without forcing you to compose EntityInfo and checksum operations manually.
Installation
dotnet add package Cuemon.Extensions.Data.Integrity
Usage guidance
Adopt this package when your application naturally starts from assemblies, files, timestamps, or existing checksum builders and you want those values to flow into CacheValidator instances with minimal ceremony. If you already build EntityInfo yourself or need integrity primitives beyond these extension points, depend on Cuemon.Data.Integrity directly.
Family packages
- 🌐Cuemon.AspNetCore
- 🏭Cuemon.AspNetCore.App
- 🌐Cuemon.AspNetCore.Authentication
- 🌐Cuemon.AspNetCore.Mvc
- 🌐Cuemon.AspNetCore.Razor.TagHelpers
- 📦Cuemon.Core
- 🏭Cuemon.Core.App
- 🗄️Cuemon.Data
- 🗄️Cuemon.Data.Integrity
- 🗄️Cuemon.Data.SqlClient
- 🩺Cuemon.Diagnostics
- 🌐Cuemon.Extensions.AspNetCore
- 🌐Cuemon.Extensions.AspNetCore.Authentication
- 🌐Cuemon.Extensions.AspNetCore.Mvc
- 🌐Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json
- 🌐Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml
- 🌐Cuemon.Extensions.AspNetCore.Mvc.RazorPages
- 🌐Cuemon.Extensions.AspNetCore.Text.Json
- 🌐Cuemon.Extensions.AspNetCore.Xml
- 📦Cuemon.Extensions.Collections.Generic
- 📦Cuemon.Extensions.Collections.Specialized
- 📦Cuemon.Extensions.Core
- 🗄️Cuemon.Extensions.Data
- 📦Cuemon.Extensions.DependencyInjection
- 🩺Cuemon.Extensions.Diagnostics
- 🏗️Cuemon.Extensions.Hosting
- 📦Cuemon.Extensions.IO
- 📦Cuemon.Extensions.Net
- 📦Cuemon.Extensions.Reflection
- 📦Cuemon.Extensions.Runtime.Caching
- 📝Cuemon.Extensions.Text
- 📝Cuemon.Extensions.Text.Json
- 📦Cuemon.Extensions.Threading
- 📦Cuemon.Extensions.Xml
- 📦Cuemon.IO
- ⚙️Cuemon.Kernel
- 📦Cuemon.Net
- 📦Cuemon.Resilience
- 📦Cuemon.Runtime.Caching
- 🔐Cuemon.Security.Cryptography
- 📦Cuemon.Threading
- 📦Cuemon.Xml