zoukankan      html  css  js  c++  java
  • Orchard学习笔记

    1、下载Orchard sourcrs资源文件,同时也可以去百度下载中文包 资源地址(https://github.com/OrchardCMS/Orchard/releases/download/1.10/Orchard.Source.zip)中文包地址以及说明(http://www.cnblogs.com/zgqys1980/archive/2012/06/15/2550951.html)

    2、解压好资源文件,在根目录有build.bin命令脚本文件,打开即可。此时就能打开运行

    3、创建HelloWord过程。

      3.1、打开Orchard命令行。Orchard命令行在Orchard.WebinOrchard.exe位置。

      3.2、启用了Code Generation,再Orchard命令行输入feature enable Orchard.CodeGeneration。当Orchard.CodeGeneration启用以后,就可以在命令行中来创建模块了。

        codegen controller <module-name> <controller-name>

        创建一个controller类

        codegen datamigration <feature-name>

        创建一个数据文件清单

        codegen module <module-name> [/IncludeInSolution:true|false] //     codegen module HelloWord

        创建一个模块

        codegen theme <theme-name> [/CreateProject:true|false][/IncludeInSolution:true|false][/BasedOn:<theme-name>]

        创建一个皮肤

       3.3、为模块添加路由Routes.cs

        

        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using Orchard.Mvc.Routes;
        using System.Web.Routing;
        using System.Web.Mvc;

        namespace MyCompany.HelloWorld
        {
        /// <summary>
        /// 定义模块所用到的路由,在Orchard中定义路由需要实现IRouteProvider接口
        /// </summary>
        public class Routes : IRouteProvider
        {
        #region IRouteProvider 成员

        public IEnumerable<RouteDescriptor> GetRoutes()
        {
        return new[]
          {
        new RouteDescriptor
        {
        Priority = 5, //优先级(作用暂不清楚,留着以后研究)
        Route = new Route
        (
        "HelloWorld", //路由的 URL 模式。
        new RouteValueDictionary //要在 URL 不包含所有参数时使用的值。默认执行HomeController中Index action。
        {
        {"area", "HelloWord"},
        {"controller", "Home"},
        {"action", "Index"}
        },
        new RouteValueDictionary(), //一个用于指定 URL 参数的有效值的正则表达式。
        new RouteValueDictionary {{"area", "HelloWord" } }, //传递到路由处理程序但未用于确定该路由是否匹配特定 URL 模式的自定义值。这些值会传递到路由处理程序,以便用于处理请求。
        new MvcRouteHandler() //处理路由请求的对象。
        )
        }
        };
        }

        public void GetRoutes(ICollection<RouteDescriptor> routes)
        {
        foreach (var routeDescriptor in GetRoutes())
        {
        routes.Add(routeDescriptor);
        }
        }

        #endregion
        }
        }

  • 相关阅读:
    Codeforces 994B. Knights of a Polygonal Table
    Codeforces 994A. Fingerprints
    Codeforces 988F. Rain and Umbrellas
    51nod 1158 全是1的最大子矩阵(单调栈 ,o(n*m))
    51nod 1102 面积最大的矩形 && 新疆大学OJ 1387: B.HUAWEI's billboard 【单调栈】+【拼凑段】(o(n) 或 o(nlog(n))
    Codeforces 988E. Divisibility by 25
    【复习资料】单片机与嵌入式系统原理及应用
    Codeforces 723D. Lakes in Berland
    Codeforces 986A. Fair(对物品bfs暴力求解)
    Codeforces 986B. Petr and Permutations(没想到这道2250分的题这么简单,早知道就先做了)
  • 原文地址:https://www.cnblogs.com/raorao1994/p/6256325.html
Copyright © 2011-2022 走看看