2. oxite project structure

Source: Internet
Author: User

Previous Article: Brief introduction to the oxite project structure-1

Oxite. backgroundservices project, as mentioned earlier, omitted.

Oxite. Database Project:

A database project facilitates database architecture and data comparison, update, and deployment. There is nothing to say about it. Who knows it.

Oxite. linqtosqldataprovider project, which has been mentioned earlier, omitted.

Oxite. livesearchprovider project. If you are interested in the livesearch API of M $, you can skip this section.

Oxite. MVCProject:

The oxite. MVC project is to extract the C layer from MVC, and it also contains something about the core v layer.

The controllers directory in the oxite. MVC project, of course, is the Controller pull. Naturally, there is an oxite basecontroller, which defines some common things, such as deleetting, common repository interfaces, some common methods, such as notfound (), localize (), at the same time, two view methods are rewritten to returnOxiteviewresultType.

Oxite. the views directory in the MVC project defines the base types of master pages, view pages, and user controls. It also defines some common attributes and methods, as mentioned above, some common attributes and methods have been defined in basecontroller. Here, pay attention to how to define these common attributes and methods in the base class of view, let's take a look at someCodeRight:

PublicAppsettingshelperAppsettings {Get{If(Viewcontext. ControllerIsBasecontroller){Return((Basecontroller) Viewcontext. Controller ).Appsettings ;}Return null;}}

 

Public StringGetabsolutepath (StringRelativepath ){If(Viewcontext. ControllerIsBasecontroller){Return((Basecontroller) Viewcontext. Controller). getabsolutepath (relativepath );}Return null;}

As you can see from the code, here is the direct returnBasecontroller. At the same time, the base classes of these views also define methods related to views, such as registering JS and CSS.

The classes in the root directory of the oxite. MVC project are basically viewresult implementation, and some extensions classes are implemented to facilitate code writing. There are several implementations of actionfilterattribute.

Here, let's take a look at the two classes. First, let's take a look at the oxiteviewengine class. This is the implementation of iviewengine to support skins:

 Public Oxiteviewengine ( String Skin) {defaskskin = skin; masterlocationformats = New [] { "~ /Skins/{2}/views/{1}/{0}. Master" , "~ /Skins/{2}/views/shared/{0}. Master" , "~ /Views/{1}/{0}. Master" , "~ /Views/shared/{0}. Master" }; Viewlocationformats = New [] { "~ /Skins/{2}/views/{1}/{0}. aspx" ,"~ /Skins/{2}/views/{1}/{0}. ascx" , "~ /Skins/{2}/views/shared/{0}. aspx" , "~ /Skins/{2}/views/shared/{0}. ascx" , "~ /Views/{1}/{0}. aspx" , "~ /Views/{1}/{0}. ascx" , "~ /Views/shared/{0}. aspx" , "~ /Views/shared/{0}. ascx" ,}; Partialviewlocationformats = viewlocationformats ;}

The constructor requires a skin parameter to specify the skin used. From the above path, we can see that the view is searched from the skins directory before searching in the Views directory.

Next, let's take a look at the oxiteapplication class, which inherits from the httpapplication class and puts the work we do in global. asax. CS at ordinary times here:

 
Protected virtual voidOnstart () {registerroutes ();Viewengines. Engines. Clear ();Viewengines. Engines. Add (NewOxiteviewengine(Config. Site. themedefault); backgroundserviceexecutors =Backgroundservicesexecutor. Start (config );}Protected virtual voidOnend (){Backgroundservicesexecutor. End (backgroundserviceexecutors );}

Here, we mainly register routes rules, register viewengine, and startBackgroundservices.

Then directly inherit from this class:

 
Public classMvcapplication: Oxite. MVC.Oxiteapplication{// Note: uncomment and add/edit/remove routes below // public override void registerroutes (routecollection routes, string [] areas) // {// base. registerroutes (routes, areas );//}}

There is nothing to say about the remaining three projects:

The view section is a simple one. In general, it feels messy. Orz...

Note: I suddenly think this article is basically nonsense. BecauseOverallFrom the above, I did not find anything prominent in this project, and it is worth in-depth analysis. I did not see the cool pleasure of blogengine. Maybe I am stupid and look forward to high people for advice. Without careful study of the code, I will not comment on it.

Enjoy! Post by Q. Lee. Lulu

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.