Skip to content

This section describes the project structure of an Orchard solution in Visual Studio.

本节介绍Visual Studio中Orchard解决方案的项目结构。

The projects and folders are listed in the order they appear in Visual Studio.

项目和文件夹按它们在Visual Studio中出现的顺序列出。

We recommend that you open the Orchard project in Visual Studio and browse through the files as you read this topic.

我们建议您在Visual Studio中打开Orchard项目,并在阅读本主题时浏览文件。

Modules

模块

Modules is a Visual Studio solution folder that contains Orchard module projects.

Modules是包含Orchard模块项目的Visual Studio解决方案文件夹。

It maps to the /Modules subfolder of the Orchard.Web web site folder.

它映射到Orchard.Web网站文件夹的/ Modules子文件夹。

Each subfolder of the Modules folder is an Orchard module.

Modules文件夹的每个子文件夹都是一个Orchard模块。

All Orchard modules are ASP.NET MVC areas.

所有Orchard模块都是ASP.NET MVC领域。

Specs

眼镜

The Specs folder contains the following projects:

_Specs_文件夹包含以下项目:

  • Orchard.Profile. This provides for creating a profiling image for Orchard.

  • Orchard.Profile。这为Orchard创建了一个分析图像。 *

  • Orchard.Specs. This contains integration tests written using a SpecFlow style. Feature-specific information is contained in the *.feature files.

  • Orchard.Specs。这包含使用[SpecFlow](http://www.specflow.org)样式编写的集成测试。特定于功能的信息包含在_ *。feature_文件中。

Tests

测试

The Tests folder contains the following projects:

_Tests_文件夹包含以下项目:

  • Orchard.Core.Tests is the test project for the Orchard.Core project.

  • Orchard.Core.Tests是Orchard.Core项目的测试项目。 *

  • Orchard.Framework.Tests is the test project for the Orchard.Framework project.

  • Orchard.Framework.Tests是Orchard.Framework项目的测试项目。 *

  • Orchard.Tests.Modules is the test project for Orchard modules. It contains subfolders for different modules.

  • Orchard.Tests.Modules是Orchard模块的测试项目。它包含不同模块的子文件夹。 *

  • Orchard.Web.Tests is the test project for the Orchard.Web project.

  • Orchard.Web.Tests是Orchard.Web项目的测试项目。 *

Tools

工具

The Tools folder contains the source code for tools that are used to build the Orchard solution.

_Tools_文件夹包含用于构建Orchard解决方案的工具的源代码。

It also contains the Orchard project, which builds the Orchard.exe command-line tool that you can use

它还包含Orchard项目,该项目构建可以使用的Orchard.exe命令行工具

to run commands defined in an Orchard website in order to automate administrative tasks.

运行Orchard网站中定义的命令以自动执行管理任务。

Orchard.Core

Orchard.Core

The Core project contains a set of core modules and content types for Orchard, such as feeds, theming,

Core项目包含一组Orchard的核心模块和内容类型,例如feed,主题,

navigation or the common, routable and body content parts.

导航或常用,可路由和正文内容部分。

Orchard.Framework Project

Orchard.Framework项目

Orchard.Framework is a class library project containing the Orchard CMS framework.

Orchard.Framework是一个包含Orchard CMS框架的类库项目。

Orchard.Web Project

Orchard.Web项目

Orchard.Web is an MVC web application project. This is the application that you actually run.

Orchard.Web是一个MVC Web应用程序项目。这是您实际运行的应用程序。

It is the startup project of the application. It contains the Orchard CMS core platform binaries and

它是应用程序的启动项目。它包含Orchard CMS核心平台二进制文件和

is therefore the Orchard CMS host application.

因此是Orchard CMS主机应用程序。

Other Notes

其他说明

  • The Orchard.Web project is set as the startup project of the solution (for example, when you use Visual Studio debugging). Orchard.Web dynamically loads all Orchard modules and discovers module extensibility points (MVC routes, admin pages, and so on.)

  • Orchard.Web项目被设置为解决方案的启动项目(例如,当您使用Visual Studio调试时)。 Orchard.Web动态加载所有Orchard模块并发现模块扩展点(MVC路由,管理页面等)。 *

  • The projects in the Modules folder are physically located under the Ochard.Web\Modules folder. This allows modules to contain ASP.NET views (.aspx, .ascx, and other files) and static content without having to copy files between projects to be able to run the project.

  • Modules_文件夹中的项目实际位于 Ochard.Web \ Modules 文件夹下。这允许模块包含ASP.NET视图(.aspx 。ascx_和其他文件)和静态内容,而无需在项目之间复制文件以便能够运行项目。

  • The Orchard.Web project has project references to the modules. This enables automatic copying of the output assemblies into the bin folder of the Orchard.Web project. Orchard.Web has no dependency on types in the Modules assemblies, because the Orchard.Web project is not supposed to have a compile-time knowledge of which modules are loaded at run time. (This is not entirely true at the current stage of Orchard development.)

  • Orchard.Web项目具有对模块的项目引用。这样可以将输出程序集自动复制到Orchard.Web项目的_bin_文件夹中。 Orchard.Web不依赖于_Modules_程序集中的类型,因为Orchard.Web项目不应该具有运行时加载哪些模块的编译时知识。 (在Orchard开发的当前阶段,这并不完全正确。) *

  • The projects in the Modules folder have a project reference to the Orchard project. This allows modules to have access to the base Orchard services.

  • _Modules_文件夹中的项目具有对Orchard项目的项目引用。这允许模块访问基本的Orchard服务。 *

About Core Modules

关于核心模块

This section discuss some of the design decisions that went into creating core modules.

本节讨论创建核心模块的一些设计决策。

The first issue is this: why are core modules modules? Because during the design phase for Orchard,

第一个问题是:为什么核心模块模块?因为在Orchard的设计阶段,

it was determined that an extensibility point such as modules was needed.

确定需要诸如模块之类的可扩展点。

Everything else would constitute the core framework.

其他一切都将构成核心框架。

For example, the Common module introduces the Body part, a core concept that is common to many

例如, Common 模块引入了 Body 部分,这是许多人共同的核心概念

types of content types, such as blog posts or pages. This could have been implemented as part of the

内容类型的类型,例如博客文章或页面。这可以作为一部分实施

Orchard framework DLL and could have had modules depend on it. However, then it would not get

Orchard框架DLL可能有依赖它的模块。然而,它不会得到

the benefit of being a module, such as being able to hook up handlers, drivers, views, routes, and so on.

作为一个模块的好处,例如能够连接处理程序,驱动程序,视图,路由等。

This also relates to MVC and areas, where everything that belongs to an area is under the same directory.

这也涉及MVC和区域,其中属于某个区域的所有内容都在同一目录下。

It was determined that the correct approach was to get certain core concepts out of the framework DLL

确定正确的方法是从框架DLL中获取某些核心概念

into a separate DLL and have them be modules. This is similar to non-monolithic operating systems where

进入一个单独的DLL并让它们成为模块。这类似于非单片操作系统

parts of the core functionality are implemented as modules outside the kernel, talking to the kernel

部分核心功能被实现为内核之外的模块,与内核通信

using the same interfaces as the more high-level modules.

使用与更高级别模块相同的接口。

A second design issue for core modules was this: why are core modules core modules?

核心模块的第二个设计问题是:为什么核心模块是核心模块?

After it was determined that core concepts would be implemented as modules, it might have made sense

在确定核心概念将作为模块实现之后,它可能是有意义的

to put them into the modules directory along with the rest of the Orchard modules, such as the comments module.

将它们与其余的Orchard模块一起放入modules目录,例如comments模块。

The problem with that approach was dependencies. In Orchard, modules that are in the modules directory

这种方法的问题是依赖性。在Orchard中,模块目录中的模块

can be disabled, uninstalled, or otherwise updated in a breaking way. Orchard modules should avoid

可以以破解方式禁用,卸载或以其他方式更新。果园模块应该避免

dependencies on other modules as much as possible -- that's part of the dynamism behind the content-type

尽可能依赖于其他模块 - 这是内容类型背后的动力的一部分

architecture. Pages and blog posts, which belong to the Pages and Blog modules, don't reference

建筑。页面和博客文章属于 Pages Blog 模块,不参考

the Comments or Tags modules, but it's possible to attach comments or tags to pages and blog posts.

评论标签模块,但可以在页面和博客帖子上附加评论或标签。

This decoupled behavior is ensured by the underlying content-type architecture and not by direct reference

这种解耦行为由底层内容类型体系结构确保,而不是通过直接引用

from another module.

来自另一个模块。

However, core modules are part of the Orchard framework and it's considered acceptable for modules to

但是,核心模块是Orchard框架的一部分,它被认为是模块可以接受的

depend on them. Core modules will be distributed by the Orchard development team, and for all practical

依靠他们。核心模块将由Orchard开发团队分发,并且实用性强

purposes are integral parts of the Orchard framework. Modules can depend on them and directly access

目的是Orchard框架的组成部分。模块可以依赖它们并直接访问

their public surface.

他们的公共表面。