Dependency injection scope
Developers familiar with dependency injection are likely to be familiar with the concept of DI Scopes. That is - some services which are designated as scoped or instance per scope use a common/shared instance for the lifetime/duration of the scope.
Within Screenplay logic, a DI scope is automatically created, with a lifetime matching that of the current Performance. Within a performance, when any of the scoped services (listed below) are injected, each point of injection will receive the same shared instance of that service. Instances are independent per-performance; each performance gets its own shared instance of each of the listed services.
List of scoped services
The following services are added to DI "per lifetime scope".
List of singleton services
The following services are added to DI as singletons.
- The Screenplay
- The event bus
- This includes its interfaces
- The Screenplay options
- The report builder
- The reporter implementation
- The implementation resolved depends upon whether reporting is enabled