Azunt.AttachmentManagement 1.0.0

dotnet add package Azunt.AttachmentManagement --version 1.0.0
                    
NuGet\Install-Package Azunt.AttachmentManagement -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Azunt.AttachmentManagement" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Azunt.AttachmentManagement" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Azunt.AttachmentManagement" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Azunt.AttachmentManagement --version 1.0.0
                    
#r "nuget: Azunt.AttachmentManagement, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Azunt.AttachmentManagement@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Azunt.AttachmentManagement&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Azunt.AttachmentManagement&version=1.0.0
                    
Install as a Cake Tool

Azunt.AttachmentManagement

Azunt.AttachmentManagement is a reusable .NET 8 module for managing attachment metadata with EF Core, SQL Server, Dapper, ADO.NET, Blazor, and Open XML Excel export.

Features

  • Unified AttachmentRecord model
  • EF Core In-Memory and SQL Server support
  • Dapper and ADO.NET repository implementations
  • Server-side search, filtering, sorting, and paging with PagedResult<T>
  • Employee, vendor, and investigation relationship metadata
  • Creation and modification audit fields
  • Safe creation or nullable-column enhancement of dbo.Attachments
  • Optional lookup-index creation
  • Blazor Server CRUD demonstration
  • Excel export with the Open XML SDK
  • MIT license

Audit fields

The module preserves creation metadata and records later changes separately:

CreatedAt
CreatedBy
ModifiedAt
ModifiedBy

UpdateAsync and UpdateMetadataAsync automatically set ModifiedAt to UTC. They update ModifiedBy only when a non-empty modifier is supplied. Update operations preserve CreatedAt, DateCreated, and CreatedBy so creation audit metadata remains immutable.

Install

dotnet add package Azunt.AttachmentManagement --version 1.0.0

Register in a .NET 8 MVC project using Startup.cs

using Azunt.AttachmentManagement;

public void ConfigureServices(IServiceCollection services)
{
    var connectionString = Configuration.GetConnectionString("DefaultConnection")
        ?? throw new InvalidOperationException("DefaultConnection is not configured.");

    services.AddDependencyInjectionContainerForAttachmentApp(
        connectionString,
        AttachmentServicesRegistrationExtensions.RepositoryMode.EfCoreSqlServer);

    services.AddControllersWithViews();
}

Use RepositoryMode.Dapper or RepositoryMode.AdoNet to select another SQL Server repository.

Create or enhance the table at startup

The default operation creates the table when missing or adds only missing nullable columns. It does not create optional indexes.

public void Configure(
    IApplicationBuilder app,
    IWebHostEnvironment env)
{
    AttachmentsTableBuilder
        .RunAsync(app.ApplicationServices)
        .GetAwaiter()
        .GetResult();

    // Remaining middleware configuration...
}

To create the recommended relationship indexes at the same time:

AttachmentsTableBuilder
    .RunAsync(app.ApplicationServices, ensureIndexes: true)
    .GetAwaiter()
    .GetResult();

For production scale-out deployments, prefer running schema enhancement once in a deployment step or administrator process rather than from every application instance.

Direct builder usage

using var scope = app.ApplicationServices.CreateScope();
var tableBuilder = scope.ServiceProvider.GetRequiredService<AttachmentsTableBuilder>();

await tableBuilder.EnsureAsync(connectionString);
await tableBuilder.EnsureIndexesAsync(connectionString);

Pack

dotnet restore .\src\Azunt.AttachmentManagement\Azunt.AttachmentManagement\Azunt.AttachmentManagement.csproj

dotnet build .\src\Azunt.AttachmentManagement\Azunt.AttachmentManagement\Azunt.AttachmentManagement.csproj `
    -c Release `
    --no-restore

dotnet pack .\src\Azunt.AttachmentManagement\Azunt.AttachmentManagement\Azunt.AttachmentManagement.csproj `
    -c Release `
    --no-build `
    -o .\artifacts

The package project is configured to create both .nupkg and .snupkg files.

Security notice

The included Azunt.Web project is a development demonstration. Add authentication, authorization, tenant isolation, request validation, secure file storage, file type and size checks, malware scanning, audit logging, and rate limiting before production deployment.

Changelog

See CHANGELOG.md for release history.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 349 7/26/2026

Initial public release with attachment metadata CRUD, audit fields, EF Core, Dapper, ADO.NET, SQL Server schema enhancement, Blazor demo, and Open XML Excel export.