Orchard Study Notes

Source: Internet
Author: User

1, download Orchard Sourcrs resource file, also can go to Baidu download Chinese package resource address (https://github.com/OrchardCMS/Orchard/releases/download/1.10/ Orchard.Source.zip) Chinese package address and description (http://www.cnblogs.com/zgqys1980/archive/2012/06/15/2550951.html)

2, unzip the good resource file, in the root directory has build.bin command script file, open can. You can now open the run

3, create the Helloword process.

3.1. Open the Orchard command line. The Orchard command line is in the Orchard.web\bin\orchard.exe position.

3.2, the code Generation is enabled, and then Orchard command line input feature enable orchard.codegeneration. When Orchard.codegeneration is enabled, the module can be created on the command line.

CodeGen Controller <module-name> <controller-name>

Create a Controller class

CodeGen datamigration <feature-name>

Create a list of data files

CodeGen module <module-name> [/includeinsolution:true|false]//codegen module Helloword

Create a module

CodeGen Theme <theme-name> [/createproject:true|false][/includeinsolution:true|false][/basedon:< Theme-name>]

Create a skin

3.3. Add route Routes.cs for module

    

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>
Define the route used by the module, define the route in orchard to implement the Irouteprovider interface
</summary>
public class Routes:irouteprovider
{
#region Irouteprovider Members

Public ienumerable<routedescriptor> getroutes ()
{
return new[]
{
New Routedescriptor
{
Priority = 5,//precedence (effect is unclear, save for later study)
Route = new route
(
"HelloWorld",//URL pattern of the route.
New RouteValueDictionary//The value to use when the URL does not contain all parameters. The default execution HomeController in the index action.
{
{"Area", "Helloword"},
{"Controller", "Home"},
{"Action", "Index"}
},
New RouteValueDictionary (),//a regular expression that specifies a valid value for the URL parameter.
New RouteValueDictionary {"Area", "Helloword"}},//is passed to the route handler but is not used to determine whether the route matches a specific URL pattern for a custom value. These values are passed to the route handler for processing the request.
New Mvcroutehandler ()//The object that handles the routing request.
)
}
};
}

public void Getroutes (icollection<routedescriptor> routes)
{
foreach (Var routedescriptor in Getroutes ())
{
Routes. ADD (Routedescriptor);
}
}

#endregion
}
}

Orchard Study Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.