Esempio n. 1
0
        protected override void UpdateConfiguration(WebRouteConfiguration configuration)
        {
            var controllers = new[] { typeof(SwaggerController), typeof(MetadataController) };

            configuration.AddControllers(controllers);

            configuration.Routes.Clear();
            configuration.InsertFormatter(FormatterFactory.CreateJson(configuration));

            IODataPathHandler handler = new SwaggerPathHandler();
            IList <IODataRoutingConvention> conventions = ODataRoutingConventions.CreateDefault();

            conventions.Insert(0, new SwaggerRoutingConvention());

            configuration.MapODataServiceRoute("odata", "odata", GetEdmModel(configuration), handler, conventions);
            configuration.EnsureInitialized();
        }