Table of Contents

Class PerformanceProvider

Namespace
CSF.Screenplay.Performances
Assembly
CSF.Screenplay.dll

A class which provides access to the current IPerformance, which exists within the current dependency injection scope.

public class PerformanceProvider
Inheritance
PerformanceProvider
Inherited Members

Remarks

This container/provider class is required for architectural reasons. Instances of Performance cannot be created upon their first resolution from dependency injection. This is because performances are immutable and require constructor parameters which are provided by the creating logic. However, performance must also be available instance-per-scope from DI. That is why this class is required, so that a created performance may be 'registered' with this class, with SetCurrentPerformance(IPerformance). This class is itself registered in DI as instance-per-scope. So, consuming logic may resolve a performance by getting an instance of this provider and then using GetCurrentPerformance().

Methods

GetCurrentPerformance()

Gets the current performance from this provider instance.

public IPerformance GetCurrentPerformance()

Returns

IPerformance

The current performance

Exceptions

InvalidOperationException

If this instance does not have a current performance.

SetCurrentPerformance(IPerformance)

Sets the current performance for this provider instance.

public void SetCurrentPerformance(IPerformance currentPerformance)

Parameters

currentPerformance IPerformance

The new current performance

Exceptions

ArgumentNullException

If currentPerformance is null

InvalidOperationException

If the current instance already has a current performance.