Antaris RazorEngine How to recompile a template using the same key?

I am using Antaris RazorEngine inside a sharepoint web part to display and render my data with a razor to completely decouple the backend from the external styling and avoid having to recompile my component.

I make the template key the same as the filename, then check

If the web application is in debug mode or the template is not cached -> Then I recompile the template

The problem comes when I try to call "RunCompile" using the same key as the razor file name, I get an exception that the same key is already in use there.

What I need to do is remove the cached template, recompile and cache it to reflect the changes I made to the razor template code.

How do I remove a Cached template?

Or How do I overwrite or recompile a cached template?

+3


source to share





All Articles