Class ReifiedOperationExtensions
Helper methods to work with reified operations.
Inheritance
Namespace: Reaqtor.ReificationFramework
Assembly: Reaqtor.ReificationFramework.dll
Syntax
public static class ReifiedOperationExtensions : Object
Methods
AsReified(QueryEngineOperation)
Converts a query engine operation to a reified operation.
Declaration
public static ReifiedOperation AsReified(this QueryEngineOperation operation)
Parameters
Type | Name | Description |
---|---|---|
QueryEngineOperation | operation | The query engine operation. |
Returns
Type | Description |
---|---|
ReifiedOperation | The query engine operations as a reified operation. |
AsReified(ServiceOperation)
Converts a query engine operation to a reified operation.
Declaration
public static ReifiedOperation AsReified(this ServiceOperation operation)
Parameters
Type | Name | Description |
---|---|---|
ServiceOperation | operation | The query engine operation. |
Returns
Type | Description |
---|---|
ReifiedOperation | The query engine operations as a reified operation. |
AsReified(IEnumerable<QueryEngineOperation>)
Converts a set of query engine operations to a set of reified operations.
Declaration
public static IEnumerable<ReifiedOperation> AsReified(this IEnumerable<QueryEngineOperation> operations)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<QueryEngineOperation> | operations | The query engine operations. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ReifiedOperation> | The query engine operations as reified operations. |
AsReified(IEnumerable<ServiceOperation>)
Converts a set of service operations to a set of reified operations.
Declaration
public static IEnumerable<ReifiedOperation> AsReified(this IEnumerable<ServiceOperation> operations)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ServiceOperation> | operations | The service operations. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ReifiedOperation> | The service operations as reified operations. |
Async(ReifiedOperation, Action<Task>, CancellationToken)
Starts an operation on a thread pool thread.
Declaration
public static ReifiedOperation Async(this ReifiedOperation operation, Action<Task> onStart, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
System.Action<System.Threading.Tasks.Task> | onStart | A callback to return the task after the operation has been started. |
System.Threading.CancellationToken | token | A cancellation token to give to the task factory. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
Bind<TEnvironment>(ReifiedOperation, IReificationBinder<TEnvironment>)
Binds a reified operation to a given environment.
Declaration
public static Expression<Action<TEnvironment>> Bind<TEnvironment>(this ReifiedOperation operation, IReificationBinder<TEnvironment> binder)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation to bind. |
IReificationBinder<TEnvironment> | binder | The binder to use. |
Returns
Type | Description |
---|---|
System.Linq.Expressions.Expression<System.Action<TEnvironment>> | A lambda expression to evaluate the reified operation. |
Type Parameters
Name | Description |
---|---|
TEnvironment | The environment type. |
Catch(ReifiedOperation, Action<Exception>)
Catches any exception thrown by the given operation.
Declaration
public static ReifiedOperation Catch(this ReifiedOperation operation, Action<Exception> handler)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
System.Action<System.Exception> | handler | The callback for any exceptions thrown. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
Catch<T>(ReifiedOperation, Action<T>)
Catches any exception of the given type thrown by the given operation.
Declaration
public static ReifiedOperation Catch<T>(this ReifiedOperation operation, Action<T> handler)
where T : Exception
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
System.Action<T> | handler | The callback for any exceptions thrown. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
Type Parameters
Name | Description |
---|---|
T | The exception type. |
Chain(ReifiedOperation, ReifiedOperation[])
Wraps a sequence of operations as a single, ordered operation.
Declaration
public static ReifiedOperation Chain(this ReifiedOperation first, params ReifiedOperation[] rest)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | first | The first operation. |
ReifiedOperation[] | rest | The rest of the operations. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
Chain(IEnumerable<ReifiedOperation>)
Wraps a sequence of operations as a single, ordered operation.
Declaration
public static ReifiedOperation Chain(this IEnumerable<ReifiedOperation> operations)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ReifiedOperation> | operations | The operations. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
Instrument(ReifiedOperation, Action, Action)
Instruments an operation with callbacks that are invoked before and after the operation.
Declaration
public static ReifiedOperation Instrument(this ReifiedOperation operation, Action onEnter, Action onExit)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
System.Action | onEnter | Callback to invoke prior to evaluating the operation. |
System.Action | onExit | Callback to invoke after evaluating the operation. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
LiftWildcards(ReifiedOperation)
Remaps all the wildcards in an operation to unique identifiers.
Declaration
public static ReifiedOperation LiftWildcards(this ReifiedOperation operation)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
LiftWildcards(ReifiedOperation, IWildcardGenerator)
Remaps all the wildcards in an operation to identifiers taken from the wildcard generator.
Declaration
public static ReifiedOperation LiftWildcards(this ReifiedOperation operation, IWildcardGenerator generator)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
IWildcardGenerator | generator | The wildcard generator. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
Map(ServiceOperation, Uri, Uri)
Maps a URI in a service operation to a new URI.
Declaration
public static ServiceOperation Map(this ServiceOperation operation, Uri original, Uri replacement)
Parameters
Type | Name | Description |
---|---|---|
ServiceOperation | operation | The service operation. |
System.Uri | original | The original URI. |
System.Uri | replacement | The replacement URI. |
Returns
Type | Description |
---|---|
ServiceOperation | The mapped operation. |
MapWildcard(ServiceOperation, Uri)
Maps a wildcard in a service operation to a new URI.
Declaration
public static ServiceOperation MapWildcard(this ServiceOperation operation, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
ServiceOperation | operation | The service operation. |
System.Uri | uri | The replacement URI. |
Returns
Type | Description |
---|---|
ServiceOperation | The mapped operation. |
Repeat(ReifiedOperation, Int64)
Repeat an operation a given number of times.
Declaration
public static ReifiedOperation Repeat(this ReifiedOperation operation, long count)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
System.Int64 | count | The number of times to repeat the operation. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
RepeatUntil(ReifiedOperation, CancellationToken)
Repeat an operation until cancellation is requested.
Declaration
public static ReifiedOperation RepeatUntil(this ReifiedOperation operation, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
ReifiedOperation | operation | The operation. |
System.Threading.CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
ReifiedOperation | The wrapped operation. |
Rewrite(ServiceOperation, Expression, Expression)
Rewrites segments of the service operation expression.
Declaration
public static ServiceOperation Rewrite(this ServiceOperation operation, Expression original, Expression replacement)
Parameters
Type | Name | Description |
---|---|---|
ServiceOperation | operation | The service operation. |
System.Linq.Expressions.Expression | original | The expression to rewrite. |
System.Linq.Expressions.Expression | replacement | The replacement expression. |
Returns
Type | Description |
---|---|
ServiceOperation | The service operation with the expression rewritten. |