Interactive Generator could be a replacement for T4 at least in Visual Studio.
The idea is to access typseafe code during generation or templating.

// Creating the class
var @class = new Class("BlueITSystems");

// Accessing typesafe on the class definition.
var instance = new BlueITSystems();

// Should result in "BlueITSystems".

// Add a method to class.
@class.Add(new Method("Test"));

// Accessing on method definition.
// Because we have source code of definition
// we can operate on syntax or semantic
// with extension methods.
var method = instance.GetSyntax(x => x.Test());

// Add code to method.
method.Add(@"Console.WriteLine(`Hello World´)");

// Invoke mehtod result in: "Hello World"

So how should this things be possible??? It is not so difficult!

So if you define some snytax, it could be directly emitted into an intermediate cache
which is injected into the current assembly and is only available during development.
If you generate you binaries it should not be inculded unless the project settings allow it.

Last edited Jun 3, 2013 at 10:30 AM by JavedSaqib, version 9


No comments yet.