Interface ISharedState
Interface that defines the Shared state that all nodes of the Dependency Graph share.
Namespace: Cortex.Net
Assembly: Cortex.Net.dll
Syntax
public interface ISharedState
Properties
| Improve this Doc View SourceAllowStateChanges
Gets a value indicating whether it is allowed to change observables at this point.
Declaration
bool AllowStateChanges { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
AllowStateReads
Gets a value indicating whether it is allowed to read observables at this point.
Declaration
bool AllowStateReads { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ComputationDepth
Gets or sets the computation depth.
Declaration
int ComputationDepth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Configuration
Gets the Configuration for the Shared State.
Declaration
CortexConfiguration Configuration { get; }
Property Value
| Type | Description |
|---|---|
| CortexConfiguration |
CurrentActionId
Gets or sets the Id of the Current Action.
Declaration
int CurrentActionId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Enhancers
Gets a list of enhancers.
Declaration
IList<IEnhancer> Enhancers { get; }
Property Value
| Type | Description |
|---|---|
| IList<IEnhancer> |
InBatch
Gets a value indicating whether the Dependency Graph is in Batch mode.
Declaration
bool InBatch { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
NextActionId
Gets or sets the Id of the Next Action.
Declaration
int NextActionId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
PendingReactions
Gets a queue of pending reactions.
Declaration
Queue<Reaction> PendingReactions { get; }
Property Value
| Type | Description |
|---|---|
| Queue<Reaction> |
PendingUnobservations
Gets a queue of all pending Unobservations.
Declaration
Queue<IObservable> PendingUnobservations { get; }
Property Value
| Type | Description |
|---|---|
| Queue<IObservable> |
RunId
Gets the shared derivation RunId counter.
Declaration
int RunId { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ShouldInvoke
Gets a value indicating whether the action should be invoked on the original thread that created the context.
Declaration
bool ShouldInvoke { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SuppressReactionErrors
Gets or sets a value indicating whether to suppress reaction errors. Suppressing happens when an action is the root cause of reactions to fail further because of the incorrect state.
Declaration
bool SuppressReactionErrors { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
TrackingDerivation
Gets the IDerivation instance that the shared state is currently tracking.
Declaration
IDerivation TrackingDerivation { get; }
Property Value
| Type | Description |
|---|---|
| IDerivation |
Methods
| Improve this Doc View SourceEndAllowStateChanges(Boolean)
End of a section where AllowStateChanges is modified.
Declaration
void EndAllowStateChanges(bool previousAllowStateChanges)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | previousAllowStateChanges | The previous value to restore. |
EndAllowStateReads(Boolean)
End of a section where AllowStateReads is modified.
Declaration
void EndAllowStateReads(bool previousAllowStateReads)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | previousAllowStateReads | The previous value to restore. |
EndBatch()
Ends a Batch.
Declaration
void EndBatch()
Remarks
This method can be called multiple times but should always be balanced with an equal amount of StartBatch() calls.
EndTracking(IDerivation)
Ends tracking the current IDerivation instance and restores the previous derivation.
Declaration
void EndTracking(IDerivation previousDerivation)
Parameters
| Type | Name | Description |
|---|---|---|
| IDerivation | previousDerivation | The previous derivation. |
GetUniqueId()
Gets a unique Id that is incremented every time.
Declaration
int GetUniqueId()
Returns
| Type | Description |
|---|---|
| System.Int32 | The new unique Id. |
IncrementRunId()
Increments the RunId and returns the new value.
Declaration
int IncrementRunId()
Returns
| Type | Description |
|---|---|
| System.Int32 | The new RunId. |
OnSpy(Object, SpyEventArgs)
Triggers the Spy event handler with the specified event args.
Declaration
void OnSpy(object sender, SpyEventArgs spyEventArgs)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The sender of the event. |
| SpyEventArgs | spyEventArgs | The event arguments for the spy event. |
OnUnhandledReactionException(Reaction, UnhandledExceptionEventArgs)
Fires the UnhandledReactionException event.
Declaration
void OnUnhandledReactionException(Reaction reaction, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
Parameters
| Type | Name | Description |
|---|---|---|
| Reaction | reaction | The reaction that caused the unhandled exception. |
| UnhandledExceptionEventArgs | unhandledExceptionEventArgs | The event arguments for the exception. |
RunReactions()
Runs reactions.
Declaration
void RunReactions()
StartAllowStateChanges(Boolean)
Start of a section where AllowStateChanges is modified.
Declaration
bool StartAllowStateChanges(bool allowStateChanges)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | allowStateChanges | Whether to allow State changes. |
Returns
| Type | Description |
|---|---|
| System.Boolean | The previous value. |
StartAllowStateReads(Boolean)
Start of a section where AllowStateReads is modified.
Declaration
bool StartAllowStateReads(bool allowStateReads)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | allowStateReads | Whether to allow State reads. |
Returns
| Type | Description |
|---|---|
| System.Boolean | The previous value. |
StartBatch()
Starts a Batch.
Declaration
void StartBatch()
Remarks
This method can be called multiple times but should always be balanced with an equal amount of EndBatch() calls.
StartTracking(IDerivation)
Starts tracking the IDerivation instance given as paramteter.
Declaration
IDerivation StartTracking(IDerivation derivation)
Parameters
| Type | Name | Description |
|---|---|---|
| IDerivation | derivation | The derivation to track. |
Returns
| Type | Description |
|---|---|
| IDerivation | The prevous derivation. |
StartUntracked()
Starts an untracked part of a derviation.
Declaration
IDerivation StartUntracked()
Returns
| Type | Description |
|---|---|
| IDerivation | The current derivation to restore later. |
Events
| Improve this Doc View SourceSpyEvent
Spy event that fires when any observable attached to this Shared State reports a significant change. Can be used to implement a state inspection tool or something like react-dev-tools.
Declaration
event EventHandler<SpyEventArgs> SpyEvent
Event Type
| Type | Description |
|---|---|
| EventHandler<SpyEventArgs> |
UnhandledReactionException
Event that fires when a reaction produces an unhandled exception.
Declaration
event EventHandler<UnhandledExceptionEventArgs> UnhandledReactionException
Event Type
| Type | Description |
|---|---|
| EventHandler<UnhandledExceptionEventArgs> |