Skip to content

Custom Value Resolver

JPVenson edited this page May 10, 2022 · 4 revisions

Per Default morestachio is capable of resolving values from either an Dynamic C# object, an Plain C# object or an IDictionary<string, object>. Morestachio also supports instances of ICustomTypeDescriptor directly. You can extend this by implimenting the IValueResolver interface and setting it with the ParserOptionsBuilder.WithValueResolver(...) used to render the template.

When you are using an C# object and want to enable per-object dynamic call evaluation, you can also just implement the IMorestachioPropertyResolver interface and handle calls on that object yourself.