1 min read
Domain LayerLast Updated - Platform 22.0 - SDK 17.0
The domain layer serves as the backbone of all features; containing the domain models that serve as the frontend contracts. This layer also includes repositories and middleware for retrieving and interacting with domain models (from the data layer).
The domain and data layers are usually contained within
Client (component) frameworks to be consumed by feature frameworks.
However, domain layers may exist within more standalone feature frameworks or in frameworks for features with no API.
Domain models are the strongly typed frontend contracts for features; usually based on matching backend contracts but simplified for better usage. They can be retrieved from or sent to the data layer via repositories using service middleware.
All SDK domain models are
Hashable structs which conform to
CustomDataProvider so that custom data can be carried to and from the data layer.
You must map your custom data in a data mapper.
Repositories, following the repository pattern, abstract access to the data exposing, and for, a specific domain.
All SDK repositories are created as protocol interface / class implementation pairs but it's easiest to subclass the
Poq prefixed implementation.
Some repositories have alternative and mock implementations.
To use repositories from a feature the SDK provides service middleware and matching