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


C# RouteCollection.MapAttributeRoutes方法代码示例

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


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

示例1: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes();
        }
开发者ID:kumarms,项目名称:photoup,代码行数:7,代码来源:AttributeRoutingConfig.cs

示例2: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // Note: All routes should be handled by the RouteAttribute on each action
            routes.MapAttributeRoutes(config => config.AddRoutesFromAssemblyOf<RouteConfig>());
        }
开发者ID:felipeleusin,项目名称:MvcKickstart,代码行数:7,代码来源:RouteConfig.cs

示例3: Setup

        public void Setup()
        {
            assertEngine = new FakeAssertEngine();
            RouteAssert.UseAssertEngine(assertEngine);

            routes = new RouteCollection();
            routes.MapAttributeRoutes(c => c.AddRoutesFromController<HomeAttrController>());
        }
开发者ID:jaredrussell,项目名称:MvcRouteTester,代码行数:8,代码来源:HomeAttrControllerFailTests.cs

示例4: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
            routes.MapAttributeRoutes();

            routes.MapHttpAttributeRoutes();
        }
开发者ID:mattoraptor,项目名称:jobwatcher,代码行数:10,代码来源:Global.asax.cs

示例5: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.UseLowercaseRoutes = true;
                config.PreserveCaseForUrlParameters = true;
            });
        }
开发者ID:marijngiesen,项目名称:qoam,代码行数:11,代码来源:AttributeRoutingConfig.cs

示例6: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
            routes.MapAttributeRoutes();
        }
开发者ID:yudamaan,项目名称:Ecommerce,代码行数:11,代码来源:RouteConfig.cs

示例7: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.AutoGenerateRouteNames = true;
            });
        }
开发者ID:Karhgath,项目名称:paragon,代码行数:11,代码来源:AttributeRouting.cs

示例8: RegisterRoutes

		public static void RegisterRoutes(RouteCollection routes) 
		{    
			// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
			// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
            
			routes.MapAttributeRoutes(config =>
			{
				config.UseLowercaseRoutes = true;
				config.PreserveCaseForUrlParameters = true;
			});
		}
开发者ID:wheeliemow,项目名称:RaccoonBlog,代码行数:11,代码来源:AttributeRoutingConfig.cs

示例9: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes();

            routes.MapRoute(
                "CatchAllRoute",
                "{*url}",
                new { controller = "Error", action = "CatchAll" }
            );
        }
开发者ID:Thinking-Beard,项目名称:civilsalary,代码行数:12,代码来源:Global.asax.cs

示例10: RegisterAttributeRoutes

        private static void RegisterAttributeRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.AddRoutesFromAssemblyOf<SearchLayer>();
                //config.AddRoutesFromAssemblyOf<YourCustomLayer>();
                config.UseLowercaseRoutes = true;
            });
        }
开发者ID:stevekennaird,项目名称:LayersCMS,代码行数:13,代码来源:KickstartLayersCms.cs

示例11: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssembly(Assembly.GetExecutingAssembly());
                config.UseLowercaseRoutes = true;
            });
        }
开发者ID:andrewburgess,项目名称:ProjectBuilder,代码行数:13,代码来源:AttributeRouting.cs

示例12: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config=>
            {
                config.ScanAssemblyOf<MvcApplication>();
                config.UseLowercaseRoutes = true;
                config.AppendTrailingSlash = true;
            });

            routes.MapRoute("CatchAll", "{*path}", new { controller = "Error", action = "FileNotFound" });
        }
开发者ID:mccalltd,项目名称:MvcStarterTemplate,代码行数:13,代码来源:Routing.cs

示例13: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            //
            routes.IgnoreRoute("elmah.axd");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
            //Skip static files
            routes.IgnoreRoute("{*staticfile}", new { staticfile = @".*\.(jpg|gif|jpeg|png|css|js)$" });

            // See http://github.com/mccalltd/AttributeRouting/wiki/3.-Configuration for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssembly(Assembly.GetExecutingAssembly());
                config.AutoGenerateRouteNames = true; //Essential for duplicate actions with GET and POST or same action with both GET POST
                //IMPORTANT: don't use the following or else it will do redirects and remove port number which won't work with AppHarbor
                config.UseLowercaseRoutes = false;
                config.AddDefaultRouteConstraint(@"^id$", new RegexRouteConstraint(@"^\d+$"));
            });

            //
            //                                   DON'T   DELETE   THE     FOLLOWING
            //
            //This is essential for:
            // -Letting domain.com open default action
            // -When generating urls with T4MVC for actions that contain parameters but we expect the path to be empty
            //  Example:
            //      For MyController.GetUpdates(long id), Url.Action(MVC.My.GetUpdates()) will result in an empty string instead of "/my/getupdates"
            //      It doesnt matter if the controller is decorated with [GET("GetUpdates/{id}")] or [POST("GetUpdates/{id}")]

            //routes.MapRoute(
            //    "Default_app", // Route name
            //    "App/{pageid}/{controller}/{action}/{id}", // URL with parameters
            //   new { pageid = "0", controller = "Home", action = "index", id = UrlParameter.Optional },
            //   new string[] {"SocialFruits.Controllers"} // Parameter defaults
            //);

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

            ////Catch reamining routes
            //routes.MapRoute("catch-all", "{*catchall}", MVC.Error.NotFound(),
            //    new string[] { "SocialFruits.Controllers" }
            //    );
        }
开发者ID:rehabriad,项目名称:MVCTest,代码行数:50,代码来源:AttributeRouting.cs

示例14: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssemblyOf<ControllerBase>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
            });

            routes.MapRoute("CatchAll",
                            "{*path}",
                            new { controller = "home", action = "filenotfound" },
                            new[] { typeof(HomeController).Namespace });
        }
开发者ID:kevinsheffield,项目名称:AttributeRouting,代码行数:15,代码来源:Global.asax.cs

示例15: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(
                config =>
                {
                    config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                    config.AddRoutesFromControllersOfType<Controller>();
                    //config.UseLowercaseRoutes = true;
                    config.DefaultSubdomain = "admin";
                    config.MapArea("Admin").ToSubdomain("admin");
                }
            );
        }
开发者ID:j-walker23,项目名称:autobotleasing,代码行数:16,代码来源:AttributeRoutingConfig.cs


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