Skip to main content

File storage & attachments

:::info Status Outline — expand with a full worked example (e.g. adding a [FilePicker] field to a new Dto). :::

The pieces

  • IBlobRepository (storage) / IBlobService (the higher-level service Dtos/behaviors use) — split so the storage backend can change without touching call sites.
  • [FilePicker] on a Guid? Dto property binds a field to a stored blob.
  • Reconciliation (orphaned blob cleanup when a record is deleted or a file is replaced) is hand-wired per entity today — there is no generator support for it yet.

Gotchas worth knowing before you start

  • Use DateTime, not DateTimeOffset, for blob metadata timestamps, consistent with the rest of the platform's UTC-everywhere convention.
  • A Form<T> cascading value is owned by the specific {Dto}Form component, not the outer page — don't expect a file-picker field nested inside a form to see a cascading value set only at the page level.
  • Unmounting a MudFileUpload before a deferred file read completes throws _blazorFilesById — make sure any async read finishes (or is cancelled) before navigating away.

See also

  • UI interfaces for [FilePicker] alongside the other custom field types.