Table of Contents

Class TransformationContext

Namespace
NMF.Transformations.Core
Assembly
NMF.Transformations.Core.dll

This is the most important class of NMF.Transformations as it handles all the transformation

public class TransformationContext : ITransformationEngineContext, ITransformationContext
Inheritance
TransformationContext
Implements
Derived
Inherited Members
Extension Methods

Constructors

TransformationContext(Transformation)

Creates a new transformation context for the given transformation

public TransformationContext(Transformation transformation)

Parameters

transformation Transformation

The transformation, a context should be generated for

Properties

Bag

Gets a Bag, where dynamic data can be added

public dynamic Bag { get; }

Property Value

dynamic

Remarks

The value of this property is an ExpandoObject, so that the bag can be easily extended with new properties

Computations

Gets all computations (for custom trace purposes)

public IEnumerable<Computation> Computations { get; }

Property Value

IEnumerable<Computation>

Data

Gets a data dictionary, where data set during the transformation can be added

public IDictionary<object, object> Data { get; }

Property Value

IDictionary<object, object>

Input

Gets the input of the transformation context

public object[] Input { get; set; }

Property Value

object[]

Remarks

If the transformation has multiple inputs, this returns the first input

Inputs

Gets a collection of inputs

public IList<object[]> Inputs { get; }

Property Value

IList<object[]>

Output

Gets the output of the transformation context

public object Output { get; }

Property Value

object

Remarks

If the transformation has multiple outputs, this property returns the first output

Outputs

Gets a collection of outputs

public IList<object> Outputs { get; }

Property Value

IList<object>

Trace

Gets the object responsible for trace operations for this transformation context

public ITransformationTrace Trace { get; }

Property Value

ITransformationTrace

Transformation

Gets the parent transformation, that the context is based upon

public Transformation Transformation { get; }

Property Value

Transformation

Methods

AddTraceEntry(Computation)

Creates a trace entry for the given computation object

protected virtual void AddTraceEntry(Computation computation)

Parameters

computation Computation

The computation that needs to be added to the trace

Remarks

Override for custom trace entries. A null-check for the argument is not required.

CallPendingDependencies()

Calls dependencies of transformations executed so far

public void CallPendingDependencies()

CallTransformation(GeneralTransformationRule, object[], IEnumerable)

Calls the given transformation with the specified input

public Computation CallTransformation(GeneralTransformationRule transformationRule, object[] input, IEnumerable context)

Parameters

transformationRule GeneralTransformationRule

The rule that should be applied

input object[]

The input for the transformation rule

context IEnumerable

The callers context

Returns

Computation

The computation that handles this request

CreateComputationContext(object[], GeneralTransformationRule)

Creates a computation context for the given input with the given transformation rule

protected virtual ComputationContext CreateComputationContext(object[] input, GeneralTransformationRule rule)

Parameters

input object[]

The inputs

rule GeneralTransformationRule

The transformation rule to process these inputs

Returns

ComputationContext

A computation context

CreateDelayedOutputs()

Creates the outputs of all delayed computations

public void CreateDelayedOutputs()

ExecuteLevel(IList<Computation>)

Executes all computations of the given level

protected virtual void ExecuteLevel(IList<Computation> computationsOfLevel)

Parameters

computationsOfLevel IList<Computation>

The computations of the given level

ExecutePending()

Calls the transformation context to finish any things yet undone

public void ExecutePending()

ExecutePendingComputations()

Executes all computations registered,but not already handled

public void ExecutePendingComputations()

GetRule(Type[], Type)

Gets any rules that apply the given signature

public GeneralTransformationRule GetRule(Type[] input, Type output)

Parameters

input Type[]

The input argument type list

output Type

The output type

Returns

GeneralTransformationRule

A random rule that has the given signature

GetRules(Type[], Type)

Gets all rules that apply the given signature

public IEnumerable<GeneralTransformationRule> GetRules(Type[] input, Type output)

Parameters

input Type[]

The input argument type list

output Type

The output type

Returns

IEnumerable<GeneralTransformationRule>

A collection with all the rules that have the given signature

OnComputationCompleted(ComputationEventArgs)

Fires the ComputationCompleted event with the given event data

protected virtual void OnComputationCompleted(ComputationEventArgs e)

Parameters

e ComputationEventArgs

The event data

Events

ComputationCompleted

Gets fired when a computation completes

public event EventHandler<ComputationEventArgs> ComputationCompleted

Event Type

EventHandler<ComputationEventArgs>