Class ActionExtensions
Extension methods for
Inheritance
Namespace: Cortex.Net.Core
Assembly: Cortex.Net.dll
Syntax
public static class ActionExtensions : object
Methods
| Improve this Doc View SourceAllowStateChanges<T>(ISharedState, Boolean, Func<T>)
Executes a function while specifying AllowStateChanges. The previous value of AllowStateChanges is automatically restored.
Declaration
public static T AllowStateChanges<T>(this ISharedState sharedState, bool allowStateChanges, Func<T> function)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The shared state to operate on. |
System.Boolean | allowStateChanges | The value for AllStateChanges to use while executing the function. |
Func<T> | function | The function to execute. |
Returns
Type | Description |
---|---|
T | The return value of the function. |
Type Parameters
Name | Description |
---|---|
T | The result type of the function. |
AllowStateChangesInsideComputed<T>(ISharedState, Func<T>)
Executes a function while storing and restoring the computation depth. This allows the computed to modify state.
Declaration
public static T AllowStateChangesInsideComputed<T>(this ISharedState sharedState, Func<T> function)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The shared state to operate on. |
Func<T> | function | The function to execute. |
Returns
Type | Description |
---|---|
T | The return value of the function. |
Type Parameters
Name | Description |
---|---|
T | The result type of the function. |
DeepEnhancer(ISharedState)
Gets the deep enhancer from the Shared State.
Declaration
public static IEnhancer DeepEnhancer(this ISharedState sharedState)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The shared state that should provide the deep enhancer. |
Returns
Type | Description |
---|---|
IEnhancer | The IEnhancer instance. |
EndAction(ActionRunInfo)
Ends an action using the specified ActionRunInfo instance.
Declaration
public static void EndAction(ActionRunInfo actionRunInfo)
Parameters
Type | Name | Description |
---|---|---|
ActionRunInfo | actionRunInfo | The run info about the action. |
GetEnhancer(ISharedState, Type)
Gets the enhancer specified by the type from the Shared State.
Declaration
public static IEnhancer GetEnhancer(this ISharedState sharedState, Type enhancerType)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The shared state that should provide the reference enhancer. |
Type | enhancerType | The type of the enhancer. |
Returns
Type | Description |
---|---|
IEnhancer | The IEnhancer instance. |
ReferenceEnhancer(ISharedState)
Gets the reference enhancer from the Shared State.
Declaration
public static IEnhancer ReferenceEnhancer(this ISharedState sharedState)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The shared state that should provide the reference enhancer. |
Returns
Type | Description |
---|---|
IEnhancer | The IEnhancer instance. |
StartAction(ISharedState, String, Object, Object[])
Starts an action that changes state and recomputes the state tree.
Declaration
public static ActionRunInfo StartAction(ISharedState sharedState, string actionName, object scope, object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The shared state instance to use. |
System.String | actionName | The name of the action. |
System.Object | scope | The scope of the action. |
System.Object[] | arguments | The arguments to the action. |
Returns
Type | Description |
---|---|
ActionRunInfo | An ActionRunInfo instance containing the information on the currently running action. |
Untracked(ISharedState, Action)
Executes an action without tracking derivations.
Declaration
public static void Untracked(this ISharedState sharedState, Action action)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The ISharedState instance to use to temporarily stop tracking derivations. |
Action | action | The action to execute. |
Untracked<T>(ISharedState, Func<T>)
Executes a function without tracking derivations.
Declaration
public static T Untracked<T>(this ISharedState sharedState, Func<T> function)
Parameters
Type | Name | Description |
---|---|---|
ISharedState | sharedState | The ISharedState instance to use to temporarily stop tracking derivations. |
Func<T> | function | The function to execute. |
Returns
Type | Description |
---|---|
T | The return value. |
Type Parameters
Name | Description |
---|---|
T | The type of the return value of the function. |