My use case - I want to render the same template using different model instances from a Powershell script. I wrap Razorlight in an exe tool, but I do not want to call the tool with all the model objects at once - instead I want to be able to pass them as they become available.
This means I cannot use the MemoryCachingProvider. What I need is a file system caching provider and a way to reuse it between the calls to the tool.
Is there anything off-the-shelf?
EDIT 1
So I am banging the wall this whole day on this thing. I have the generated Assembly object, but it is not serializable. It is an in-memory assembly, so no file on disk. And there seems to be no way in RazorLight to instruct the compilation to save it on disk.
I must be missing something really obvious here, at least this is the sentiment I get from the first comment to this post. Please, put me out of my misery - share what am I missing here.
So I failed to find a way to do it in the current version of RazorLight. I am extremely curious as to the "too many ways to approach this problem".
Anyway, my solution to the problem is to modify the RazorLight code to enable such a feature. Here is the PR - https://github.com/toddams/RazorLight/pull/492
If merged and released, then it would be possible to write a cache like this:
And then one could use it like this: