You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Routes.cs 1.1KB

12345678910111213141516171819202122232425262728293031
  1. using System.Data.Services;
  2. using System.ServiceModel.Activation;
  3. using System.Web.Routing;
  4. using Ninject;
  5. using NuGet.Server;
  6. using NuGet.Server.DataServices;
  7. using NuGet.Server.Infrastructure;
  8. using RouteMagic;
  9. [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(NuGet_server.NuGetRoutes), "Start")]
  10. namespace NuGet_server {
  11. public static class NuGetRoutes {
  12. public static void Start() {
  13. MapRoutes(RouteTable.Routes);
  14. }
  15. private static void MapRoutes(RouteCollection routes) {
  16. // The default route is http://{root}/nuget/Packages
  17. var factory = new DataServiceHostFactory();
  18. var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
  19. serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
  20. serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
  21. routes.Add("nuget", serviceRoute);
  22. }
  23. private static PackageService CreatePackageService() {
  24. return NinjectBootstrapper.Kernel.Get<PackageService>();
  25. }
  26. }
  27. }