[翻译]Orchard文档-命令行基架

Code generation是一个用于创建附加文件和扩展的自动化任务Orchard模块.这个功能对开发者创建控制器[Controllers]、数据迁移类[Data Migration]、模块[Module]和主题[Theme]很有帮助.但是,在安装Orchard时Code generation并不会被默认安装.

你可以使用Orchard Gallery来安装Code generation功能.打开管理面板,点击Gallery标题下的Modules选项.

gallery_modules_675

找到Code generation模块,然后点击安装.

gallery_code_generation_675

启动Code generation : 点击Features下的Configuartion,找到Code generation功能,然后点击启动.

enable_codegen

从Orchard命令行启动功能 : 打开Orchard命令行,然后输入以下命令,更多关于Orchard命令行的信息,请看Using the command-line interface.

orchard> feature enable Orchard.CodeGeneration
         Enabling features Orchard.CodeGeneration Orchard.CodeGeneration was enabled

一旦code generation功能被打开,一些新的命令将可用于创建模块[Module]主题[Theme]数据迁移[Data Migration]或者控制器[Controller].现在,code generation命令将会把文件添加在合适的位置.

codegen controller <module-name> <controller-name>
        Create a new Orchard controller in a module

codegen datamigration <feature-name>
        Create a new Data Migration class

codegen module <module-name> [/IncludeInSolution:true|false]
        Create a new Orchard module

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

codegen moduletests <module-name> 
        Create a new test for a module

使用code generation功能创建一个新的模块和数据迁移的演练,请看Writing a content part.

posted @ 2014-08-19 08:43  Ghost.KR  阅读(342)  评论(1编辑  收藏  举报