您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }