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()); }
/// <summary> /// Configure the provider given a list of action classes. /// </summary> /// <param name="provider">The provider to configure.</param> /// <param name="items">The list of classes to interrogate.</param> protected void Configure(DirectProvider provider, IEnumerable <object> items) { provider.Configure(items); }
/// <summary> /// Configure the provider using reflection by getting the appropriate methods from an assembly. /// </summary> /// <param name="provider">The provider to configure.</param> /// <param name="assembly">The assembly to interrogate.</param> /// <param name="exclusions">A list of classes to exclude.</param> protected void Configure(DirectProvider provider, Assembly assembly, IEnumerable <object> exclusions) { provider.Configure(assembly, exclusions); }
/// <summary> /// Configure the provider with the appropriate set of methods. /// </summary> /// <param name="provider">The provider to be configured.</param> /// <remarks>This method is virtual to allow for custom configurations.</remarks> protected virtual void ConfigureProvider(DirectProvider provider) { provider.Configure(new object[] { this }); }
/// <summary> /// Configure the provider given a list of action classes. /// </summary> /// <param name="provider">The provider to configure.</param> /// <param name="items">The list of classes to interrogate.</param> protected void Configure(DirectProvider provider, IEnumerable<object> items) { provider.Configure(items); }
/// <summary> /// Configure the provider using reflection by getting the appropriate methods from an assembly. /// </summary> /// <param name="provider">The provider to configure.</param> /// <param name="assembly">The assembly to interrogate.</param> /// <param name="exclusions">A list of classes to exclude.</param> protected void Configure(DirectProvider provider, Assembly assembly, IEnumerable<object> exclusions) { provider.Configure(assembly, exclusions); }