public virtual View.ViewContext Context() { if (vc == null) { if (injector == null) { // One downside of making the injection in subclasses optional throw new WebAppException(StringHelper.Join("Error accessing ViewContext from a\n" , "child constructor, either move the usage of the View methods\n", "out of the constructor or inject the ViewContext into the\n" , "constructor")); } vc = injector.GetInstance <View.ViewContext>(); } return(vc); }
public View(View.ViewContext ctx) { // Makes injection in subclasses optional. // Time will tell if this buy us more than the NPEs :) vc = ctx; }