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


C# RouteCollection.ForController方法代码示例

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


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

示例1: Register

        public static void Register(RouteCollection routes)
        {
            routes.ForController<HomeController>()
                .MapRoute(Home.Get(), c => c.Index);

            routes.ForController<MonstersController>()
                .MapRoute(MonsterList.Get(), c => c.List)
                .MapRoute(MonstersInCategory.Get(), c => c.ListCategory)
                .MapRoute(MonsterDetail.Get(), c => c.ShowNewOrExisting)
                .MapRoute(AddEditMonster, c => c.SaveNewOrExisting)
                .MapRoute(DoDeleteMonster, c => c.Delete)
                .MapRoute(AdvancedSearch.Get(), c => c.Search);
        }
开发者ID:bunsen32,项目名称:typed-url-routing,代码行数:13,代码来源:SiteUrls.cs

示例2: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.ForController<HomeController>()
                .MapRoute(Home.Get(), c => c.Home)
                .MapRoute(Literal1.Get(), c => c.LiteralPath)
                .MapRoute(Path1Arg.Get(), c => c.OneIntArg)
                .MapRoute(Path2Args.Get(), c => c.TwoArgs)
                .MapRoute(Path1String.Get(), c => c.OneString)
                .MapRoute(QueryDateRange.Get(), c => c.DateRange)
                .MapRoute(PostDateRange, c => c.DateRange)
                .MapRoute(UploadForm.Get(), c => c.UploadForm)
                .MapRoute(UploadAFile, c => c.UploadAFile)
                ;

            // Always declare this last:
            routes.ForController<HomeController>()
                .MapRoute(Get(CatchAll), c => c.NotFound);
        }
开发者ID:bunsen32,项目名称:typed-url-routing,代码行数:18,代码来源:Routes.cs

示例3: AddTranslation_ConfigurationValidateRoutePrefixIsFalse_IgnoresMissingRoutePrefixAttribute

        public void AddTranslation_ConfigurationValidateRoutePrefixIsFalse_IgnoresMissingRoutePrefixAttribute()
        {
            // Arrange
            Configuration.AcceptedCultures.Add("de");

            Configuration.ValidateRoutePrefix = false;

            RouteCollection routeCollection = new RouteCollection();
            routeCollection.MapRoute("Home", "Home", new { controller = "MissingAttribute", action = "Index" }, null);

            // Act
            routeCollection.ForController<MissingAttributeController>().ForAction(x => x.Index()).SetRoutePrefix("de")
                .AddTranslation("Start", "de");
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:14,代码来源:RouteTranslatorTests.cs

示例4: AddTranslation_NullController_ThrowsArgumentNullException

        public void AddTranslation_NullController_ThrowsArgumentNullException()
        {
            // Arrange
            RouteCollection routeCollection = new RouteCollection();

            // Act
            routeCollection.ForController(null).ForAction("Index").AddTranslation("Start", "de");
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:8,代码来源:RouteTranslatorTests.cs

示例5: AddTranslation_MissingRoutePrefixAttribute_ThrowsInvalidOperationException

        public void AddTranslation_MissingRoutePrefixAttribute_ThrowsInvalidOperationException()
        {
            // Arrange
            Configuration.AcceptedCultures.Add("de");

            RouteCollection routeCollection = new RouteCollection();
            routeCollection.MapRoute("Home", "Home", new { controller = "MissingAttribute", action = "Index" }, null);

            // Act
            routeCollection.ForController<MissingAttributeController>().ForAction(x => x.Index()).SetRoutePrefix("de")
                .AddTranslation("Start", "de");
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:12,代码来源:RouteTranslatorTests.cs


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