コード例 #1
0
ファイル: Routes.cs プロジェクト: monoman/NugetCracker
        private static void MapRoutes(RouteCollection routes)
        {
            // Route to create a new package
            routes.MapDelegate("CreatePackage",
                               "api/v2/package",
                               new { httpMethod = new HttpMethodConstraint("PUT") },
                               context => CreatePackageService().CreatePackage(context.HttpContext));

            // Route to delete packages
            routes.MapDelegate("DeletePackage",
                               "api/v2/package/{packageId}/{version}",
                               new { httpMethod = new HttpMethodConstraint("DELETE") },
                               context => CreatePackageService().DeletePackage(context.HttpContext));

            // Route to get packages
            routes.MapDelegate("DownloadPackage",
                               "api/v2/package/{packageId}/{version}",
                               new { httpMethod = new HttpMethodConstraint("GET") },
                               context => CreatePackageService().DownloadPackage(context.HttpContext));

#if DEBUG
            // The default route is http://{root}/nuget/Packages
            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            routes.Add("nuget", serviceRoute);
#endif
        }
コード例 #2
0
ファイル: Routes.cs プロジェクト: iinteractive/Infinity.NuGet
 private static void MapRoutes(RouteCollection routes) {
     // The default route is http://{root}/nuget/Packages
     var factory = new DataServiceHostFactory();
     var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
     serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
     serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
     routes.Add("nuget", serviceRoute);
 }
コード例 #3
0
ファイル: Global.asax.cs プロジェクト: scbond/MongOData
 private void RegisterRoutes()
 {
     DataServiceHostFactory factory = new DataServiceHostFactory();
     string serverName = Utils.ExtractServerNameFromConnectionString(ConfigurationManager.ConnectionStrings["MongoDB"].ConnectionString);
     var databaseNames = MongoContext.GetDatabaseNames(serverName);
     foreach (var databaseName in databaseNames)
     {
         RouteTable.Routes.Add(new ServiceRoute(databaseName, factory, typeof(MongOData)));
     }
 }
コード例 #4
0
ファイル: Routes.cs プロジェクト: h82258652/NugetServer
        public static void Start()
        {
            // The default route is http://{root}/nuget/Packages

            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            RouteTable.Routes.Add("nuget", serviceRoute);
        }
コード例 #5
0
ファイル: Routes.cs プロジェクト: finsaspa/Caravan
        private static void MapRoutes(RouteCollection routes) {
            // Route to create a new package(http://{root}/nuget)
            routes.MapDelegate("CreatePackageNuGet",
                               "nuget",
                               new { httpMethod = new HttpMethodConstraint("PUT") },
                               context => CreatePackageService().CreatePackage(context.HttpContext));

            // The default route is http://{root}/nuget/Packages
            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            routes.Add("nuget", serviceRoute);
        }
コード例 #6
0
        private static void MapRoutes(RouteCollection routes)
        {
            // The default route is http://{root}/nuget/Packages
            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            routes.Add("nuget", serviceRoute);

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            // For some godforsaken reason, the PublishPackage route (registered by NuGet.Server) causes the { controller, action } => url mapping to always return this route.
            routes.Remove(routes.OfType<Route>().Single(r => r.DataTokens != null && r.DataTokens.ContainsKey("__RouteName") && (string)r.DataTokens["__RouteName"] == "PublishPackage"));
        }
コード例 #7
0
ファイル: Global.asax.cs プロジェクト: jeffdepascale/A5js_api
 protected void Application_Start(object sender, EventArgs e)
 {
     DataServiceHostFactory factory = new DataServiceHostFactory();
     RouteTable.Routes.Add(
         new ServiceRoute("", factory, typeof(A5jsAPI)));
 }
コード例 #8
0
 private static void RegisterRoutes()
 {
     DataServiceHostFactory factory = new DataServiceHostFactory();
     RouteTable.Routes.Add(
         new ServiceRoute(ODataValidator.ServiceName, factory, typeof(ODataValidator)));
 }