The Pattern in .NET¶
using E2c;
Configuration via DSL¶
The configuration determines the data flow.
var config = new string[] {
".run -- action",
" action.render -- render",
" render.output -- .out",
" action.log -- log",
" log.store -- .out"
};
Actors¶
Each function represents an actor.
public class Actors
{
public void Action(
string data, Output<string> render,
Output<int, string> store)
{
render.Invoke(data);
Console.WriteLine(
string.Format("{0} in Action', data));
log.Invoke("render done");
}
public void Render(string data)
{
Console.WriteLine(
string.Format("{0} in Render', data));
}
public void Store(int id, string data)
{
Console.WriteLine(
string.Format("{0} and {1} in Store', id, data));
}
}
Graph¶
var actors = new Actors();
var graph = new Graph(config);
graph.Actor("action", actors.Action);
graph.Actor("render", actors.Render);
graph.Actor("store", actors.Store);
Visualize¶
graph.Visualize();