Skip to content

Concepts

Pragmatic.Attachments is a trait package for parent-child file metadata.

The parent entity stays your domain aggregate. The generated attachment entity stores metadata about files associated with that parent:

  • original file name
  • content type
  • size
  • storage URI
  • uploader and timestamps

The actual file bytes live in Pragmatic.Storage, not in the attachment entity itself.

From a single [HasAttachments], the consuming project gets:

  • a typed {Parent}Attachment entity
  • EF configuration and FK
  • actions for upload, download, and delete
  • attachment endpoints under the parent resource
  • a navigation collection on the parent

The trait relies on other Pragmatic building blocks for different concerns:

  • Pragmatic.Persistence for entity shape and EF integration
  • Pragmatic.Storage for physical file storage
  • Pragmatic.Endpoints for generated HTTP endpoints