Antaris/RazorEngine — Issue #27: Streamlining the ITemplateService API
Author: Antaris
Created: 2012-02-21 10:42:36+00:00
State: open

Hi All,

Scott Nickel (https://github.com/scottnickel) has been investigating the possibility of streamling the ITemplateService API. Currently we offer a number of overloads for supporting generic arguments, e.g. `Parse(string template, T model)`.

This design was done for a number of reasons:

1. We had defined a generic `ITemplate` template, allow you to access the model in a statically typed way, and extend upon the generic definition, by subclassing `TemplateBase`.
2. We were using the generic `XXX` methods to support `dynamic`, so we could easily cast back to `ITemplate` when setting dynamic models (and also anonymous models).
3. We were using the generic arguments to support setting the template model, by casting back to an `ITemplate`, instead of using reflection (via `SetModelExplicit`).

What could *potentially* be achieved, is the removal of these generic overloads in favour of a set of simpler overloads (e.g. `Parse(string, object)`, `Run(string, object)`, `Compile(string, object, name)`, etc.).

But before I commit myself to making this change, I need to understand how this will likely affect you, the users of the library. Currently were still technically tagged as `beta`, and I'd like to move the project forward to release, but this is an opportunity to tackle a breaking API change before we hit a final release.

What do you think?