apex-enterprise-patterns / at4dx

Advanced Techniques for Salesforce DX Adoption Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple, prioritized Selectors

stohn777 opened this issue · comments

Background

FFLIB and AT4DX offer many features that enable the development of applications using SOLID principles and facilitate very precises unit testing. However in non-productions environments, sometimes the application doesn't have data that would be available in Production and that data cannot be added to the SObject because of valid platform limitations. Therefore having the ability to override canonical logic with non-production substitutes is needed, providing development, testing, demonstrations, and other non-production activities a better representation of the intended business experience.

Reference

Solution Concept

Currently the binding logic prohibits multiple bindings for the same SObject.

  1. Remove the logic prohibiting bindings for the same SObject.
  2. Like the Domain-process-injection and Unit-of-Work bindings, provide a prioritization field. Null would correspond to the lowest priority.

In a non-production environment, engineers may deploy substitute selectors, having a higher priority, effectively overriding the canonical selector.

Illustration

Consider this use case where the application's canonical LoginHistory selector would not have any data supporting the business logic. With this enhancement in non-production environments, engineers could deploy a higher-priority Selector that acquires representative data from a different source, enable developers and non-production users the intended application experience.

image

Pull Request #77