5

I'm new to Nancy and Razor (and MVC). If I make a change to a view I have to restart the application somehow (change web.config, restart dev server etc) for the change to take affect.

I think the cache may be Razor's static dictionary? It stores each compiled view? No doubt this is great for production, but how do I turn it off for development? I want to be able to modify a view, save, build and see the change.

Any advise greatly appreciated. Thanks.

1
  • 5
    +1 "Nancy With Razor" - new song title of the week
    – sehe
    Sep 27, 2011 at 7:41

1 Answer 1

2

This will be fixed for 0.8, but for now you can turn the caching off by adding a line to your bootstrapper's InitializeInternal like this:

public class CustomBootstrapper : DefaultNancyBootstrapper
{
    protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container)
    {
        base.InitialiseInternal(container);
#if DEBUG
        StaticConfiguration.DisableCaches = true;
#endif
    }
}
1
  • You da Man! At first it didn't work - but once I had renamed my view the cache was off from then on. x1000 thanks. Sep 27, 2011 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.