private SillyController GetController(string name) { if (String.IsNullOrEmpty(name)) { return(null); } SillyController selectedController = null; Controllers.TryGetValue(name.ToLower(), out selectedController); return(selectedController); }
protected void RegisterController(string key, SillyController controller) { if (String.IsNullOrEmpty(key)) { if (controller == null) { throw new SillyException(SillyHttpStatusCode.ServerError, "Cannot register empty key AND null Controller"); } key = controller.GetType().Name.ToLower(); } // if controller is null, it will be culled out if the controller is ever selected for execution, so we don't // blow up the entire system if one controller is "bad" // should probably log this somewhere, that'd be nice, m'kay Controllers[key] = controller; }