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


C# IMapper.Resource方法代码示例

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


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

示例1: Map

        public override void Map(IMapper map)
        {
            map.DebugRoute("routedebug");

            map.Root<CategoryController>(c => c.Index("/"));

            map.Resources<UserController>();

            map.Resources<ReportController>(c => c.Member(x => x.Get("Search")));

            map.Resources<ReportParameterController>(reportParameter => reportParameter.Only("Index"));

            map.Resources<CategoryController>(category => category.Only("Index"));

            map.Resources<ClientController>(client => client.Only("Index"));

            map.Resources<RoleController>(r => r.WithFormatRoutes());

            map.Resource<FileController>(file => file.Only("Create"));

            map.Resource<SearchController>(s => s.Only("New", "Create"));

            map.Resources<AccountController>(
                account =>
                    {
                        account.Except("new", "create", "show", "index", "update", "destroy");
                        account.Collection(x => x.Get("Login"));
                        account.Collection(x => x.Post("Login"));
                        account.Collection(x => x.Get("Register"));
                        account.Collection(x => x.Post("Register"));
                        account.Collection(x => x.Put("Confirm"));
                    });
        }
开发者ID:rexwhitten,项目名称:reportspace,代码行数:33,代码来源:Routes.cs

示例2: Map

        public override void Map(IMapper map)
        {
            map.DebugRoute("routedebug");
            map.Root<CommentsController>(c => c.Index(null));
            map.Resources<CommentsController>(c => c.Only("index", "new", "create"));
            map.Resource<ContactController>(c => c.Only("new", "create"));
            map.Resource<ErrorController>(e => e.Only("show"));

            /*
             * Note: You can register and next resources
             *
            map.Root<HomeController>(x => x.Index());

            map.Resources<BlogsController>(blogs =>
            {
                blogs.As("weblogs");
                blogs.Only("index", "show");
                blogs.Collection(x => x.Get("latest"));

                blogs.Resources<PostsController>(posts =>
                {
                    posts.Except("create", "update", "destroy");
                    posts.Resources<CommentsController>(c => c.Except("destroy"));
                });
            });

            map.Area<Controllers.Admin.BlogsController>("admin", admin =>
            {
                admin.Resources<Controllers.Admin.BlogsController>();
                admin.Resources<Controllers.Admin.PostsController>();
            });
             */
        }
开发者ID:khalidabuhakmeh,项目名称:AspNetMvcTalk,代码行数:33,代码来源:Routes.cs

示例3: Map

        public override void Map(IMapper map)
        {
            if (HttpContext.Current != null && HttpContext.Current.IsDebuggingEnabled)
            {
                map.DebugRoute(RouteDiagnosticsVirtualPath);
            }

            map.Root<HomeController>(c => c.Index());

            map.Resources<BragController>(c => c.Only("new", "create"));

            // use the standard restful routes for managing runtime Sessions:
            map.Resource<SessionController>(c => c.Only("create", "new", "destroy"));

            // add human-friendly shortcuts for logging in and out:
            map.Path("login").GetOnly().To<SessionController>(c => c.New());
            map.Path("logout").GetOnly().To<HomeController>(c => c.Logout());

            // add a path to the OUr Services page
            map.Path("ourservice").GetOnly().To<HomeController>(c => c.OurService());
            map.Path("admin").GetOnly().To<HomeController>(c => c.Admin());

            // HACK: add a standard MVC pattern-matching route limited
            //       to the PartialController to support calls like:
            //       Html.RenderAction("login", "partial");
            map.Route(new Route("partial/{action}",
                                new RouteValueDictionary(new {controller = "partial"}),
                                new MvcRouteHandler()));
        }
开发者ID:cantis,项目名称:peerconnect,代码行数:29,代码来源:Routes.cs

示例4: Map

        public override void Map(IMapper map)
        {
            // register the route debugger
            map.DebugRoute("routedebug");
            // register the root of the site
            map.Root<HomeController>(x => x.Index());
            map.Resource<QuickStartController>(quickstart => quickstart.Only("show"));

            // Connecting RouteSets: notice that we are connecting another RouteSet to this one
            map.Connect<OtherRouteSet>();

            // Mapping an area: notice, all these controllers are part of the area
            map.Area<AreasController>("mappings", area => {
                area.Resource<ResourceController>();
                area.Resources<ResourcesController>(resources => {
                    // we are nesting a resource inside of another resource
                    resources.Resources<OtherResourcesController>(other => other.Only("index"));
                    // using collection
                    resources.Collection(r => r.Get("many"));
                    // using member
                    resources.Member(r => r.Get("lonely"));
                });
                area.Resource<AreasController>();
                area.Resource<ExtrasController>(extras => {
                    // renaming the url part
                    extras.As("extras");
                    // using member, notice collection is unavailable
                    extras.Member(e => e.Get("member"));
                    // Use path
                    extras.Path("using_path").To<ExtrasController>(e => e.UsingPath()).GetOnly();
                    // Using route
                    extras.Route(new Route("mappings/extras/with_route", new RouteValueDictionary(new { controller = "extras", action = "usingroute", area = "mappings" }), new MvcRouteHandler()));
                    // Format route action, register like always
                    extras.Member(e => e.Get("awesome"));
                    // enable format routes
                    extras.WithFormatRoutes();
                });
            });

            // Not the route debuger, just a controller
            map.Resource<RouteDebuggerController>(debug => debug.Only("show"));
        }
开发者ID:jhollingworth,项目名称:restful-routing,代码行数:42,代码来源:Routes.cs

示例5: Map

            public override void Map(IMapper map)
            {
                #if DEBUG
                map.DebugRoute("routedebug");
                #endif

                map.Root<HomeController>(x => x.Index());

                map.Resource<HomeController>(home =>
                {
                    home.Only();
                });

                map.Resources<WikiController>(wiki =>
                {
                    wiki.As("wiki");
                    wiki.Only("index", "show");
                });

                map.Resources<TestAgentsController>(agents =>
                {
                    agents.As("agents");
                    agents.Only("index", "show");
                });

                map.Resources<TestProjectsController>(projects =>
                {
                    projects.As("projects");

                    projects.Resources<TestBuildsController>(builds =>
                    {
                        builds.As("builds");
                        builds.Only("index", "new", "create");
                    });

                    projects.Resources<TestPlansController>(plans =>
                    {
                        plans.As("plans");
                    });

                    projects.Resources<TestSessionsController>(sessions =>
                    {
                        sessions.As("sessions");
                        sessions.Member(z => z.Post("restart"));
                        sessions.Member(z => z.Post("continue"));
                    });
                });
            }
开发者ID:moonavw,项目名称:testlab,代码行数:48,代码来源:RouteConfig.cs

示例6: Map

        public override void Map(IMapper map)
        {
            map.DebugRoute("routedebug");

            map.Root<HomeController>(c => c.Index());

            // use the standard restful routes for managing runtime Sessions:
            map.Resource<SessionController>(c =>
            {
                c.Only("create", "new", "destroy");
            });

            // add human-friendly shortcuts for logging in and out:
            map.Path("login").GetOnly().To<SessionController>(c => c.New());
            map.Path("logout").GetOnly().To<HomeController>(c => c.Logout());

            // HACK: add a standard MVC pattern-matching route limited
            //       to the PartialController to support calls like:
            //       Html.RenderAction("login", "partial");
            map.Route(new Route("partial/{action}",
                                new RouteValueDictionary(new {controller = "partial"}),
                                new MvcRouteHandler()));
        }
开发者ID:davidalpert,项目名称:peerconnect,代码行数:23,代码来源:Routes.cs

示例7: Map

 public override void Map(IMapper map)
 {
     map.Resource<RouteSetController>(routeSet => routeSet.Only("show"));
 }
开发者ID:radischevo,项目名称:restful-routing,代码行数:4,代码来源:Routes.cs

示例8: Map

 public override void Map(IMapper map)
 {
     // doesn't matter what controller, we 
     map.Resource<PostsController>(p => p.Only("show"));
 }
开发者ID:radischevo,项目名称:restful-routing,代码行数:5,代码来源:ConnectMapperSpec.cs


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