Closed Merlin04 closed 10 months ago
Hi, is there any actual difference between having one assembly with several templates and several assemblies with one template?
Yes, if you define methods in one template you can access them in another. There also should be a performance gain when compiling multiple templates in one assembly vs multiple templates in multiple assemblies.
I will close this PR as its a perfect candidate for extension method similar to https://github.com/adoconnection/RazorEngineCore/wiki/@Include-and-@Layout
This PR adds support for compiling and running sets of templates. An example of how this works can be seen in the test
TestCompileAndRun_Set
:Both
Template1
andTemplate2
are compiled into the same assembly/IRazorEngineCompiledTemplateSet
, and the template to run can be selected by its class name (set in the dictionary of template sources). In addition, you can provide a list of strings toCompileSet
that contain C# code which will be included in the assembly.