In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "brief introduction of Orchard architecture", the content of the explanation is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "a brief introduction to Orchard architecture" bar!
It is more important for us to learn how Orchard is structured and what to do if we write a similar application ourselves. If you have time to take a look at the rest of Orchard today, this article introduces some of the architectural aspects of Orchard. Orchard has a lot of content, but we still have a superficial understanding of it, and we still need to learn it further and put it as an essay.
Architecture
Orchard foundations
Orchard is built on top of some existing frameworks and class libraries, and here are some of the main things:
ASP.NET MVC: this is Microsoft's open source MVC-based Web development framework
NHibernate:NHibernate is an ORM tool that evolved from Hibernate
Autofac: an IoC container. Orchard makes heavy use of dependency injection
Castle Dynamic Proxy: Castle is an open source project that appeared very early in .net, and Castle Dynamic Proxy is something that produces dynamic agents.
Orchard Framework
Orchard framework is at the bottom of Orchard, and you can think of it as the basic class library for Orchard.
Startup of Orchard
When the Orchard web application is started, a singleton OrchardHost (DefaultOrchardHost) at the application domain level is generated
View Code
Public class MvcApplication: HttpApplication {protected void Application_Start () {_ host = OrchardStarter.CreateHost (MvcSingletons); _ host.Initialize ();} public static class OrchardStarter {public static IOrchardHost CreateHost (Action registrations) {var container = CreateHostContainer (registrations); return container.Resolve ();} public static IContainer CreateHostContainer (Action registrations) {. Builder.RegisterType (). As (). As (). SingleInstance ();}}
DefaultOrchardHost is responsible for generating Shell, which introduces some classes: ShellContextFactory, ExtensionManager, ShellSettingsManager, CompositionStrategy, ShellBlueprint. I won't go into details now, because I haven't thought about it yet.
V public class DefaultOrchardHost: IOrchardHost, IShellSettingsManagerEventHandler, IShellDescriptorManagerEventHandler {void IOrchardHost.Initialize () {BuildCurrent ();} IEnumerable BuildCurrent () {if (_ current = = null) {lock (_ syncLock) {if (_ current = = null) {SetupExtensions (); MonitorExtensions (); _ current = CreateAndActivate (). ToArray ();}} return _ current;} IEnumerable CreateAndActivate () {var allSettings = _ shellSettingsManager.LoadSettings (); if (allSettings.Any ()) {return allSettings.Select (settings = > {var context = CreateShellContext (settings)) ActivateShell (context); return context;});}. } ShellContext CreateShellContext (ShellSettings settings) {if (settings.State.CurrentState = = TenantState.State.Uninitialized) {Logger.Debug ("Creating shell context for tenant {0} setup", settings.Name); return _ shellContextFactory.CreateSetupContext (settings);} Logger.Debug ("Creating shell context for tenant {0}", settings.Name); return _ shellContextFactory.CreateShellContext (settings);}}
Dependency injection
The standard way to generate dependencies in Orchard is to implement IDependency or its inherited interface.
There are three possible ranges of dependency, which are explained in detail and wait for later analysis:
O Request: a new instance is created for each HTTP request, and the request is processed with destruction. This kind of object implements IDependency
O Object: implement ITransientDependency. Instances are not shared.
O Shell: implement ISingletonDependency, singleton
ASP.NET MVC
Orchard is a framework built on top of ASP.NET MVC, but it also adds additional layers and concepts to add themes, multi-tenancy, and other additional features. For example, LayoutAwareViewEngine is introduced when a specific view is needed. Strictly speaking, this is not a new view engine, because it does not care about the actual drawing, but only contains some logical functions to find the correct view under the current topic, and then delegate to the actual view engine to show.
Types, Parts and Fields
Orchard can handle any content type (content types), and the content type is composed of content Parts. For example, a blog or video may have an address, reply, tag, etc. For reuse, the reply can be stored in a module as a part, so it only needs to be generated once.
Parts itself has its own properties and content fields. Content field (Fields) is also a concept of reuse, which is finer-grained than parts and can be used in multiple part.
Content Manager
All content is accessed through ContentManager objects. ContentManager has the functions of querying content storage, version content and managing release status.
Transactions
Orchard automatically generates a transaction for each HTTP request
Event bus
Commands
Many actions that can be performed in Orchard can be performed on the command line. These Command need to be implemented, and the command method is identified by the CommandName attribute.
Search and indexing
Lucene is used by default for indexing and querying
Caching
Based on caching on ASP.NET cache, the main benefit of Orchard caching API is transparency to each tenant
File systems
Orchard's file system is abstract, either a direct physical file or a blob storage deployed in the cloud
Orchard core
Orchard.Core assemblies contain modules that must be used by Orchard, such as feeds, navigation, and routable
Modules
Orchard releases some built-in modules by default, such as blog and so on. A module is just an ASP.NET MVC area file that contains a manifest.txt file.
Thank you for your reading, the above is the content of the "brief introduction of Orchard architecture", after the study of this article, I believe you have a deeper understanding of the brief introduction of Orchard architecture, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.