Skip to content

Could I pass some model into the template? #2

Answered by atifaziz
ignatandrei asked this question in Q&A
Discussion options

You must be logged in to vote

At present, I have designed two modes of operation depending on the first parsed token of the template:

  1. If the first token is a text literal then a simple partial class is written based on the file name plus the Template suffix. The class will have a single, private, instance-based and parameter-less method called RenderCore.
  2. If the first token is code ({%%}) then you are responsible for providing the entire class and method definition, thus having complete control over what and how you allow to be passed as a model (e.g. via one or more parameters).

In either mode, you have to provide two additional methods that must have the following signatures:

  • WriteText(string value): called to e…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ignatandrei
Comment options

Answer selected by atifaziz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1 on February 27, 2021 14:54.