Is it possible to extend the SubSonic generator without modifying it’s code?
I would like to add my own custom methods that i can use inside the templates. Somthing similair like the Utility.GetVariableType method.
Is it possible to extend the SubSonic generator without modifying it’s code? I would
Share
I’ve found the solution for my own problem :).
I can now extend SubSonic with functionality i need in the templates without needing to rebuild or change any of the SubSonic code itself.
It works for what i wanted to do and i think it can be usefull for others as well so here it is:
Create a new class library SubSonicHelper. Mine has a class looking like this:
Edit your own templates and at the following after the
const bool showGenerationInfo = false;After this you have an instance of the GeneratorHelper that you can use inside the template. For accessing the methods you need to do the following:
Check the result object to see the result of the method.
That’s it! Now i can extend the SubSonicHelper class with other methods i want to use inside the template.