This project is read-only.

Compile to dll

Aug 8, 2011 at 9:00 PM

What does the compile function actually do? Is there a way to compile the cshtml to a dll for use in other apps? 

Aug 8, 2011 at 9:58 PM

The "Compile" method is there to pre-compile the razor file without running it. It is useful when you want to pre-cache the razor files so that the first call to them isn't delayed. By default when you call "parse" it compiles the resulting razor file and then runs it. After that initial call it just runs it once. However that initial compile takes a second or two. Compile puts you in control of where the razor file is first compiled. Like on loading the application or in the Init of the website.

Aug 8, 2011 at 11:32 PM

Thanks, I was getting worried about the 2 second compile time for each parse call. Is the name parameter used for the cache key for the pre-compiled code?

Aug 8, 2011 at 11:41 PM

I found the answer, thanks. The name param is the cache key. Sweet!