Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Debugging Web API Hello World
Message
De
02/05/2017 12:14:40
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Divers
Thread ID:
01650768
Message ID:
01650782
Vues:
20
>>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).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform