Пример #1
0
 // called to stop the handler and clear up resources
 public static void Stop()
 {
     Logger.Debug("Stopping model handler by clearing out all held resources");
     Logger.Destroy();
     _running = false;
     _RPC_URL = null;
     _RPC_SELECT = null;
     _invalidModels = null;
     _cacheTimer.Dispose();
     _jsonURL = null;
     _jqueryURL = null;
     _backboneURL = null;
     _invalidModels = null;
     _LoadAlls = null;
     _Loads = null;
     _SelectLists = null;
     _TypeMaps = null;
     _loadedTypes = null;
 }
Пример #2
0
 /*
  * This function will start the request handler, it does this by first validating 
  * all located models, and will react according to the starttype specified.
  * It will also assign jquery,json and backbone urls as specified.
  * It will then create the url check regex, locat all load,loadalls, and select list methods
  * as well as specify types to urls, once complete it flags running to allow for handling requests.
  */
 public static void Start(StartTypes startType,string jqueryURL,string jsonURL,string backboneURL,ILogWriter logWriter)
 {
     Logger.Setup(logWriter);
     Logger.Debug("Starting up BackBone request handler");
     _startType = startType;
     _loadedTypes = new List<Type>();
     _LoadAlls = new Dictionary<string, MethodInfo>();
     _Loads = new Dictionary<string, MethodInfo>();
     _ExposedMethods = new Dictionary<string, List<MethodInfo>>();
     _SelectLists = new Dictionary<string, List<sModelListCall>>();
     _CachedJScript = new Dictionary<string, CachedItemContainer>();
     _TypeMaps = new Dictionary<string, Type>();
     _cacheTimer = new Timer(new TimerCallback(_CleanJSCache), null, 0, _CACHE_TIMER_PERIOD);
     _ModelListCalls = new List<sModelListCall>();
     _DeleteMethods = new Dictionary<Type, MethodInfo>();
     _SaveMethods = new Dictionary<Type, MethodInfo>();
     _UpdateMethods = new Dictionary<Type, MethodInfo>();
     _RPC_URL = new RequestPathChecker();
     _RPC_SELECT = new RequestPathChecker();
     _jqueryURL = jqueryURL;
     _jsonURL = jsonURL;
     _backboneURL = backboneURL;
     if (_jqueryURL != null)
     {
         _jqueryURL = (!_jqueryURL.StartsWith("/") ? "/" + _jqueryURL : _jqueryURL);
         _RPC_URL.AddMethod("GET", "*", _jqueryURL);
     }
     if (_jsonURL != null)
     {
         _jsonURL = (!_jsonURL.StartsWith("/") ? "/" + _jsonURL : _jsonURL);
         _RPC_URL.AddMethod("GET", "*", _jsonURL);
     }
     if (_backboneURL != null)
     {
         _backboneURL = (!_backboneURL.StartsWith("/") ? "/" + _backboneURL : _backboneURL);
         _RPC_URL.AddMethod("GET", "*", _backboneURL);
     }
     Logger.Debug("Backbone request handler successfully started");
     AssemblyAdded();
 }