当前位置: 首页>>代码示例>>C#>>正文


C# RouteCollection.Insert方法代码示例

本文整理汇总了C#中RouteCollection.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.Insert方法的具体用法?C# RouteCollection.Insert怎么用?C# RouteCollection.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteCollection的用法示例。


在下文中一共展示了RouteCollection.Insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Add(new CustomViewEngine());
            var routeArticleGroupAdmin = routes.MapRoute("Plugin.Misc.Articles.ArticleGroup.Admin",
                "Admin/ArticleGroup/{action}/{id}",
                new { controller = "ArticleGroup", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Articles.Controllers" }
                );
            routeArticleGroupAdmin.DataTokens.Add("area", "admin");
            routes.Remove(routeArticleGroupAdmin);
            routes.Insert(0, routeArticleGroupAdmin);

            var routeArticleAdmin = routes.MapRoute("Plugin.Misc.Articles.Article.Admin",
                "Admin/Article/{action}/{id}",
                new { controller = "Article", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Articles.Controllers" }
                );
            routeArticleAdmin.DataTokens.Add("area", "admin");
            routes.Remove(routeArticleAdmin);
            routes.Insert(0, routeArticleAdmin);
            //routes.MapRoute("ArticleAdmin",
            //      "Admin/Plugins/ArticleManagement/ArticleAdmin/{action}/{id}",
            //      new { controller = "ArticleAdmin", action = "Index", id = UrlParameter.Optional },
            //      new[] { "Nop.Plugin.Other.ArticleManagement.Controllers" }
            // ).DataTokens.Add("area", "admin"); ;
        }
开发者ID:phatnguyen81,项目名称:vlsaomai,代码行数:26,代码来源:RouteProvider.cs

示例2: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.Auctions.Public.AuctionsController",
                "Auctions/{action}/{id}",
                new { area = "Public", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Public.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Vendor.AuctionsController",
                "Vendor/Auctions/{action}/{id}",
                new { area = "Vendor", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Admin.AuctionsController",
                "Admin/Auctions/{action}/{id}",
                new { area = "Admin", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Admin.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
开发者ID:mhsohail,项目名称:Livetameion_3.7,代码行数:28,代码来源:RouteConfig.cs

示例3: InstallRoutes

        static void InstallRoutes(RouteCollection routes)
        {
            var assetRoute = new Route("_instantcss/assets/{*path}", new AssetRouteHandler());
            routes.Insert(0, assetRoute);

            var connectionRoute = routes.MapConnection<ExpressCssConnection>("ExpressCss", "_instantcss/connection/{*operation}");
            routes.Remove(connectionRoute);
            routes.Insert(1, connectionRoute);
        }
开发者ID:modulexcite,项目名称:expresscss,代码行数:9,代码来源:Application.cs

示例4: InitializeDynamicData

        private static void InitializeDynamicData(RouteCollection routes, string root, IAppConfiguration configuration)
        {
            try
            {
                DefaultModel.RegisterContext(
                    new EFCodeFirstDataModelProvider(
                        () => new EntitiesContext(configuration.SqlConnectionString, readOnly: false)), // DB Admins do not need to respect read-only mode.
                        configuration: new ContextConfiguration { ScaffoldAllTables = true });
            }
            catch (SqlException e)
            {
                QuietLog.LogHandledException(e);
                return;
            }
            catch (DataException e)
            {
                QuietLog.LogHandledException(e);
                return;
            }

            // This route must come first to prevent some other route from the site to take over
            _route = new DynamicDataRoute(root + "/{table}/{action}")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = DefaultModel
            };
            routes.Insert(0, _route);

            routes.MapPageRoute(
                "dd_default",
                root,
                "~/Areas/Admin/DynamicData/Default.aspx");
        }
开发者ID:Pliner,项目名称:NuGetGallery,代码行数:33,代码来源:DynamicDataManager.cs

示例5: RegisterRoutes

        /// <summary>
        /// Registers the routes.
        /// </summary>
        /// <param name="routeCollection">The route collection.</param>
        public static void RegisterRoutes(RouteCollection routeCollection)
        {
            List<RouteBase> routes = new List<RouteBase> {
                new Route("sitemap.xml",
                    new RouteValueDictionary(
                        new { controller = "XmlSiteMap", action = "Index", page = 0 }),
                            new MvcRouteHandler()),

                new Route("sitemap-{page}.xml",
                    new RouteValueDictionary(
                        new { controller = "XmlSiteMap", action = "Index", page = 0 }),
                            new MvcRouteHandler())
            };

            if (routeCollection.Count == 0)
            {
                foreach (var route in routes)
                {
                    routeCollection.Add(route);
                }
            }
            else
            {
                foreach (var route in routes)
                {
                    routeCollection.Insert(routeCollection.Count - 1, route);
                }
            }
        }
开发者ID:Guymestef,项目名称:MvcSiteMapProvider,代码行数:33,代码来源:XmlSiteMapController.cs

示例6: InstallRoute

 static void InstallRoute(RouteCollection routes)
 {
     var route = new CassetteRoute(
         "_cassette/jasmine/{*specbundle}",
         new DelegateRouteHandler(context => new PageHandler(context))
     );
     routes.Insert(0, route);
 }
开发者ID:nlerikheemskerk,项目名称:cassette,代码行数:8,代码来源:StartUp.cs

示例7: RegisterArea

        public virtual void RegisterArea(RouteCollection routes, ViewEngineCollection viewEngines, IEngine engine)
        {
            var route = new ContentRoute<IManagementHomePart>(engine);
            routes.Insert(0, route);

            var viewLocationFormats = new[] { Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/{1}/{0}.ascx"), Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/Shared/{0}.ascx") };
            viewEngines.Insert(0, new PrivateViewEngineDecorator(new WebFormViewEngine { AreaViewLocationFormats = viewLocationFormats, PartialViewLocationFormats = viewLocationFormats }, route));
        }
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:8,代码来源:ManagementAreaRegistration.cs

示例8: RegisterDefault

		/// <summary>
		/// Used in Gloabal.asax to setup this CacheManager to handle paths where the RouteOptions.BasePath
		/// leading directory is used to distinguish the paths
		/// </summary>
		/// <param name="routes"></param>
		/// <param name="opts"></param>
		public static void RegisterDefault(RouteCollection routes, CachingOptions opts = null)
		{
			opts = opts ?? new CachingOptions();

			var path = string.Format("{0}/{{hash}}/{{type}}/{{*path}}", opts.BasePath);

			var mgr = new CacheManager(LoadAssets(opts.CacheFile), opts);

			routes.Insert(0, new Route(path, new CacheHandler(mgr)));

			Instance = mgr;
		}
开发者ID:lcaballero,项目名称:CompileTime.ResourceCombining,代码行数:18,代码来源:CacheManager.cs

示例9: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Insert(0, new PluginViewEngine());
            //contact us example

               var  route = routes.MapRoute("ContactUsCustom","contactus",
            new { controller = "ContactUs", action = "ContactUs" },
            namespaces: new[] { "Nop.Plugins.MyStore.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

              route = routes.MapRoute("ProductExtendedFields",
              "Admin/Category/ProductExtendedFields/{productId}",
              new { controller = "ExtendedFields", action = "ProductExtendedFields" },
              new[] { "Nop.Plugins.MyStore.Controllers" }
              );

            route.DataTokens.Add("area", "admin");
            routes.Remove(route);
            routes.Insert(0, route);
        }
开发者ID:yarik-uteam,项目名称:MyStore,代码行数:22,代码来源:RouteProvider.cs

示例10: AddNotFoundRoute

        void AddNotFoundRoute(RouteCollection routes)
        {
            // To allow IIS to execute "/notfound" when requesting something which is disallowed,
            // such as /bin or /add_data.
            var route = new Route(
                "notfound",
                new RouteValueDictionary(new {controller = "NotFound", action = "NotFound"}),
                new RouteValueDictionary(new {incoming = new IncomingRequestRouteConstraint()}),
                new MvcRouteHandler()
            );

            // Insert at start of route table. This means the application can still create another route like "{name}" that won't capture "/notfound".
            routes.Insert(0, route);
        }
开发者ID:DevRainSolutions,项目名称:KyivSmartCity,代码行数:14,代码来源:InstallerModule.cs

示例11: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            using (routes.GetWriteLock())
            {
                routes.Insert(
                    0,
                    new Route(
                        CacheTagMvcSettings.RouteUrl,
                        new RouteValueDictionary(new {controller = "CacheTag", action = "Resource"}),
                        new MvcRouteHandler()
                        )
                    );

                routes.Insert(
                    0,
                    new Route(
                        CacheTagMvcSettings.RouteUrl + ".{ext}",
                        new RouteValueDictionary(new { controller = "CacheTag", action = "Resource", ext = UrlParameter.Optional }),
                        new MvcRouteHandler()
                        )
                    );
            }
        }
开发者ID:steamcore,项目名称:CacheTag,代码行数:23,代码来源:Routing.cs

示例12: ConfigureEditRoute

        public void ConfigureEditRoute(RouteCollection routes, string prefix)
        {
            var routeValueDictionary = new RouteValueDictionary
                                           {
                                               {"controller", "ReallyTinyCms"},
                                               {"action", "Index"},
                                               {"name", UrlParameter.Optional}
                                           };

            var route1 = new Route(prefix + "/{action}/{name}", routeValueDictionary, new MvcRouteHandler());
            var route2 = new Route(prefix + "/{action}/{name}", routeValueDictionary, new MvcRouteHandler());

            routes.Add("ReallyTinyCmsAdmin", route1);
            routes.Insert(0, route2);
        }
开发者ID:davidwhitney,项目名称:ReallyTinyCms,代码行数:15,代码来源:ConfigurationBuilder.cs

示例13: Register

        public static void Register(RouteCollection routes)
        {
            // This route must come first to prevent some other route from the site to take over
            routes.Insert(0, new DynamicDataRoute("dbadmin/{table}/{action}")
                             {
                                 Constraints = new RouteValueDictionary(new {action = "List|Details|Edit|Insert"}),
                                 Model = DefaultModel
                             });

            routes.MapPageRoute(
                "dd_default",
                "{dbadmin}",
                "~/DynamicData/Default.aspx",
                true,
                new RouteValueDictionary(),
                new RouteValueDictionary {{"dbadmin", "dbadmin"}});
        }
开发者ID:snoopydo,项目名称:TournamentMaker,代码行数:17,代码来源:Registration.cs

示例14: Register

        public static void Register(RouteCollection routes)
        {
            DefaultModel.RegisterContext(
               new EFCodeFirstDataModelProvider(() => new EntitiesContext()),
               new ContextConfiguration() { ScaffoldAllTables = true });

            // This route must come first to prevent some other route from the site to take over
            routes.Insert(0, new DynamicDataRoute("dbadmin/{table}/{action}")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = DefaultModel
            });

            routes.MapPageRoute(
                "dd_default",
                "dbadmin",
                "~/DynamicData/Default.aspx");
        }
开发者ID:Redsandro,项目名称:chocolatey.org,代码行数:18,代码来源:Registration.cs

示例15: Register

        public static void Register(RouteCollection routes)
        {
            DefaultModel.RegisterContext(
                () => ((IObjectContextAdapter)new ReviewRDbContext()).ObjectContext,
                new ContextConfiguration() { ScaffoldAllTables = true });
            DefaultModel.DynamicDataFolderVirtualPath = "~/DynamicData/DynamicData";

            // This route must come first to prevent some other route from the site to take over
            routes.Insert(0, new DynamicDataRoute("_dbadmin/{table}/{action}")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = DefaultModel
            });

            routes.MapPageRoute(
                "dd_default",
                "_dbadmin",
                "~/DynamicData/Default.aspx");
        }
开发者ID:anurse,项目名称:ReviewR,代码行数:19,代码来源:Registration.cs


注:本文中的RouteCollection.Insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。