Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Debugging Web API Hello World
Message
From
02/05/2017 12:14:40
 
General information
Forum:
ASP.NET
Category:
Web Services
Miscellaneous
Thread ID:
01650768
Message ID:
01650782
Views:
21
>>2. Below is the code of the WebApiConfig class. Could someone please explain it - in English - as simply as possible (if possible).
>>
>>
>>   public static class WebApiConfig
>>    {
>>        public static void Register(HttpConfiguration config)
>>        {
>>            // Web API configuration and services
>>
>>            // Web API routes
>>            config.MapHttpAttributeRoutes();
>>
>>            config.Routes.MapHttpRoute(
>>                name: "DefaultApi",
>>                routeTemplate: "api/{controller}/{id}",
>>                defaults: new { id = RouteParameter.Optional }
>>            );
>>        }
>>    }
>>
>>
>
>I have a questions regarding the the MapHttpRoute method (above). I read in a book that "the MapHttproute method simply adds a new entry in a dictionary that stores all the routes." Where is this 'dictionary'? In which format is it?

It's created by the system. I *think* you can inspect the entries via GlobalConfiguration.Configuration.Routes (it's a collection of HttpRoutes).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform