Developers: architecture¶
This section is for developers who build on Media Bridge from their own extension, or who need to understand how it works inside. Media Bridge targets Business Central 28.0 (runtime 17.1) and is SaaS-first.
All objects use the FRW affix and live in the namespace
TheFramework.MediaBridge, with these sub-namespaces:
| Namespace | Contents |
|---|---|
TheFramework.MediaBridge.Storage |
Storage interfaces, providers, the FRW Media Storage Mgt facade, the shared drop control |
TheFramework.MediaBridge.Setup |
Setup table and page, Manual Setup registration, permission sets |
TheFramework.MediaBridge.Migration |
Migration engine, runs and log, wizard, clear utilities |
TheFramework.MediaBridge.Inventory |
Item and Item Variant adapters, pages and the Item Carousel |
TheFramework.MediaBridge.HumanResources |
Employee adapter and pages |
Two extensible enums, two interfaces¶
flowchart TD
P[Pages and event subscribers] --> F[codeunit FRW Media Storage Mgt]
F --> S[[enum FRW Media Storage Source<br/>implements FRW IMediaStorageProvider]]
F --> E[[enum FRW Media Entity<br/>implements FRW IMediaEntity]]
S --> T[FRW Tenant Media Provider]
S --> X[FRW Ext. Storage Provider]
X --> O[FRW IExternalFileOps<br/>External File Storage module]
E --> I[FRW Item Media Entity]
E --> V[FRW Item Var. Media Entity]
E --> M[FRW Employee Media Entity]
E --> U[FRW Unknown Media Entity<br/>default: raises an error]
Where a picture is stored
: enum "FRW Media Storage Source" (Extensible = true) implements
interface "FRW IMediaStorageProvider": TenantMedia →
FRW Tenant Media Provider, ExternalFileStorage →
FRW Ext. Storage Provider.
Which record a picture belongs to
: enum "FRW Media Entity" (Extensible = true) implements
interface "FRW IMediaEntity": Item, ItemVariant, Employee. The
default and unknown-value implementation is FRW Unknown Media Entity,
which raises an error, so a value without an adapter never silently acts
as another entity.
One entry point
: codeunit "FRW Media Storage Mgt" is the only object pages and
subscribers call. It resolves the active provider from setup and
handles consumer mode (media source company).
Design rules¶
- Providers don't modify business records.
UploadPicturereturns the file path and timestamp; the caller writes them to the record withSetExtFileReference.DeletePictureremoves bytes; the caller clears the reference. This keeps database writes out of[TryFunction]s. - Tenant Media writes can't be try-wrapped.
Media.ImportStreaminserts the Tenant Media row at once. Batch callers useFRW Media Record Writerthrough a conditionalCodeunit.Run, which rolls back only the failing record. - Read errors carry a reason. A failed read raises inside the
provider's try, so
GetLastErrorText()names the real cause. - One MIME map. MIME type ↔ file extension mapping lives only in
FRW Media Storage Mgt. - Control add-ins are asynchronous. Every AL → JavaScript call waits
for
OnControlReady, JavaScript never returns values, and add-in references are never kept in single-instance codeunits. Each add-in is wrapped behind an interface (FRW IItemCarousel,FRW IPictureDropControl) so the logic can be tested with a mock.
What's in this section¶
- Public API: the procedures of
FRW Media Storage Mgtyou can call from your extension. - Extension points: adding a storage provider or a media entity, and the current limits.
- Telemetry: the telemetry events Media Bridge emits.