public void MapODataRoutes(HttpConfiguration config)
        {
            var builder = new NuGetWebApiODataModelBuilder();

            builder.Build();

            config.Formatters.InsertRange(0,
                                          ODataMediaTypeFormatters.Create(
                                              new ODataPackageDefaultStreamAwareSerializerProvider(),
                                              new DefaultODataDeserializerProvider()));

            var conventions = new List <IODataRoutingConvention>
            {
                new CompositeKeyRoutingConvention(),
                new CompositeKeyPropertyRoutingConvention(),
                new NonBindableActionRoutingConvention("PackagesOData"),
                new EntitySetCountRoutingConvention(),
                new NonBindableActionCountRoutingConvention("PackagesOData")
            };

            conventions.AddRange(ODataRoutingConventions.CreateDefault());

            conventions = conventions.Select(c => new ControllerAliasingODataRoutingConvention(c, "Packages", "PackagesOData")).Cast <IODataRoutingConvention>().ToList();

            config.Routes.MapODataServiceRoute(
                RouteNames.Packages.Feed,
                ODataRoutePath,
                builder.Model,
                new CountODataPathHandler(),
                conventions,
                new HeaderCascadingODataBatchHandler(new BatchHttpServer(config)));
        }
        public void MapODataRoutes(HttpConfiguration config)
        {
            var builder = new NuGetWebApiODataModelBuilder();

            builder.Build();

            config.Formatters.InsertRange(0,
                ODataMediaTypeFormatters.Create(
                    new ODataPackageDefaultStreamAwareSerializerProvider(),
                    new DefaultODataDeserializerProvider()));

            var conventions = new List<IODataRoutingConvention>
            {
                new CompositeKeyRoutingConvention(),
                new CompositeKeyPropertyRoutingConvention(),
                new NonBindableActionRoutingConvention("PackagesOData"),
                new EntitySetCountRoutingConvention(),
                new NonBindableActionCountRoutingConvention("PackagesOData")
            };

            conventions.AddRange(ODataRoutingConventions.CreateDefault());

            conventions = conventions.Select(c => new ControllerAliasingODataRoutingConvention(c, "Packages", "PackagesOData")).Cast<IODataRoutingConvention>().ToList();

            config.Routes.MapODataServiceRoute(
                RouteNames.Packages.Feed,
                ODataRoutePath,
                builder.Model,
                new CountODataPathHandler(),
                conventions,
                new HeaderCascadingODataBatchHandler(new BatchHttpServer(config)));
        }