Ejemplo n.º 1
0
        private string GetRouteFromType(Type controllerType)
        {
            if (ServicesControllerAttribute.IsPresentOn(controllerType))
            {
                var name = _controllerNameGenerator.GetName(controllerType);

                return(string.Concat(_servicesConfiguration.Configuration.Services.Routes.RouteBase,
                                     name.Replace('.', '/')));
            }

            return("See Routes tab for details");
        }
Ejemplo n.º 2
0
        private Dictionary <string, HttpControllerDescriptor> InitializeControllerDictionary()
        {
            var dictionary                 = new Dictionary <string, HttpControllerDescriptor>(StringComparer.OrdinalIgnoreCase);
            var assembliesResolver         = _configuration.Services.GetAssembliesResolver();
            var httpControllerTypeResolver = _configuration.Services.GetHttpControllerTypeResolver();
            var controllerTypes            = httpControllerTypeResolver.GetControllerTypes(assembliesResolver);

            foreach (var current in controllerTypes)
            {
                var name = _controllerNameGenerator.GetName(current);
                if (!dictionary.Keys.Contains(name))
                {
                    dictionary[name] = new HttpControllerDescriptor(_configuration, current.Name, current);
                }
            }
            return(dictionary);
        }