Introduction
The NJection project provides a way to inject .NET code at runtime using configuration files.
NJection uses new capabilities of the System.Linq.Expressions namespace which comes with visual studio 2010 and .NET 4.0 Framework .
C# Example
var actionExpression = ExpressionBuilder.Traverse<Expression<Action<string>>>(filePath);
Action<string> action = actionExpression.Compile();
action("Hello World!");
Configuration Example
Here we defined a method call to WriteLine of the static class Console.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<expression type="Lambda" typeof="System.Action`1[System.String]">
<expression type="Call" kind="Static" typeof="System.Console" methodName="WriteLine">
<arguments>
<expression ref="valueParameter" />
</arguments>
</expression>
<arguments>
<expression type="Parameter" typeof="System.String" name="valueParameter" />
</arguments>
</expression>
</configuration>