/// <summary> /// Method to reset the state of this provider, so that the API will be re-generated /// </summary> protected void Reset() { DirectProviderCache cache = DirectProviderCache.GetInstance(); if (cache.ContainsProvider(this.ProviderName)) { cache[this.ProviderName].Clear(); } }
public void ProcessRequest(HttpContext context) { string apiName = ConfigurationManager.AppSettings[NameConfig]; string routerUrl = ConfigurationManager.AppSettings[RouterConfig]; string ns = ConfigurationManager.AppSettings[NamespaceConfig] ?? ""; string assemblyName = ConfigurationManager.AppSettings[AssemblyConfig]; if (String.IsNullOrEmpty(apiName) || String.IsNullOrEmpty(routerUrl)) { string s = "window.alert('Configuration Error:\\n\\nExtDirect_ApiName or ExtDirect_RouterUrl are not defined.\\nPlease add them to appSettings section in your configuration file.');"; context.Response.Write(s); context.Response.End(); } context.Response.ContentType = "text/javascript"; DirectProviderCache cache = DirectProviderCache.GetInstance(); DirectProvider provider; cache.Clear(); if (!cache.ContainsKey(apiName)) { provider = new DirectProvider() { Name = apiName, Url = routerUrl }; if (!string.IsNullOrEmpty(ns)) { provider.Namespace = ns; } provider.Configure(System.Reflection.Assembly.Load(assemblyName)); cache.Add(apiName, provider); } else { provider = cache[apiName]; } context.Response.Write(provider.ToString()); }
private DirectProvider GetProvider(HttpContext context, string name) { DirectProviderCache cache = DirectProviderCache.GetInstance(); if (!cache.ContainsProvider(name)) { DirectProvider provider = new DirectProvider() { Name = name, Url = context.Request.Path, Namespace = this.Namespace, Timeout = this.Timeout, MaxRetries = this.MaxRetries, AutoNamespace = this.AutoNamespace, Id = this.Id }; this.ConfigureProvider(provider); cache.Add(provider); } return(cache[name]); }