kamsar / Blade

Blade is a presentation framework for Sitecore 7. Blade is currently considered deprecated as Sitecore MVC is mature enough to make Blade no longer needed. Still good and stable for Web Forms projects though.
MIT License
12 stars 4 forks source link

Change DoRender method to avoid possible exceptions #4

Closed aaronmrice closed 10 years ago

aaronmrice commented 11 years ago

It's common for the GetCachingID() method to try to access properties on the Model, which will throw an exception if the Model is null. This change allows GetCachingID methods to assume that their Model is not null.

kamsar commented 10 years ago

Generally speaking if GetCachingID() is invoking properties on the model there's not much being cached - the expensive backend calls have already been made to evaluate the cache validity. Generally you want to avoid loading the model at all if you're caching the control.

The view's implementation of GetCachingID() should be handling a null model, should it need to evaluate the model for some reason, if that's the case.