Mvc3-Based Multi-User razor shop template switching Design Concept

Source: Internet
Author: User

The actual application of mvc3 is still not long. Some things are being explored. The project is a multi-user multi-template store. The following are the solutions in the actual development process. I feel that the solution is not the best, however, we can only think of this at the moment. I hope the experts in the garden can give some suggestions.

1. directory structure of the project solution.

Syw. Core mainly contains entity classes and dependency InjectionProgramAnd plug-ins and data access interfaces.

Syw. Data. sqlserver is a lot of SQL, implementing the idata class in syw. Core. I have never used the ORM in depth, but I still feel more comfortable controlling my SQL to the maximum extent. All sets are list or ilist type.

The syw. services business processing layer is similar to the previous BLL. Here, the static method is used, and the interface is not used. The project is not very big. It will be very tired if there are too many interfaces for one person to develop.

For syw. Test Unit Testing, sometimes the results returned by debugging are very useful.

Syw. admin, background management, but the "nopcommerce" that I refer to directly generate the "Administrator" folder under the directory where the view and content folders are located, however, the DLL file is generated to syw. in the Web main directory, I do not need to use a second-level domain name to access the background. You can use http://xxxx.com/admin.

Syw. Framework is mainly used for some basic help classes. For example, Slice Processing, mail sending help class, string processing, custom UI, and so on.

2. template path and Structure

A1, A2, and B1 are templates of different styles, not only in different colors, but also in different typographical modes. Currently, there are only three templates. In this way, select a template. A1 and A2 are shop-type, and A3 is used by service enterprises.

_ Layoutstore. cshtml is the main template page of the store. Use @ hmtl. Action to access the childaction loading page and @ renderbody () to load the home page.

 

 <!  Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"  >  <  Html  Xmlns  = "Http://www.w3.org/1999/xhtml"  >  <  Head  >  <  Meta HTTP-equiv  = "X-UA-compatible"  Content  = "Ie = emulateie7"   />  <  Title  > @ Viewbag. Title-ooxx </  Title  >  <  Meta  Name  = "Keywords"  Content = "@ Viewbag. Title"  >  <  Meta  Name  = "Description"  Content  = "@ Viewbag. Title"  >  <  Script  Type  = "Text/JavaScript"  SRC  = "/Scripts/jquery-1.4.4.min.js"  > </ Script  >  <  Link  Href  = "/Storethemes/A2/content/style2.css"  Type  = "Text/CSS"  REL  = "Stylesheet"   />  </  Head  >  <  Body  > <! --  Banner and above Headers  -->  @ Html. Action ("Header", "Store", new {store = viewbag. model. Store })  <! --  Banner and above head ends  -->       <! --  Top Banner and navigation  --> <! --  Consider passing the Parameter Model  -->  @ HTML. action ("topbanner", "Store", new {store = viewbag. model. store, act = URL. requestcontext. routedata. values ["action"]. tostring (). tolower ()}) <! --  Top Banner and navigation end  -->    <  Div  Class  = "Con"  >  @ Html. Action ("sidebar", "Store", new {store = viewbag. model. Store })  <  Div  Class  = "Con-Right"  >          <! --  Include -->  @ Renderbody ()  <! --  Include end  -->      </  Div  >    </  Div  >    <! --  Footer  -->  @ Html. Action ("footer", "Store", new {store = viewbag. model. Store })  <! -- Footer ends  -->  </  Body  >  </  Html  > 

 

Actions in storecontroller

         # Region About us ///   <Summary>          ///  Shop Introduction  ///   </Summary>         ///   <Returns> </returns>          Public Actionresult about ( Int  ID ){  VaR Model = New  Storemodel (); Model. Store = Storeservice. getstorebyid (ID); Model. currentaction = Routedata. Values [ "  Action  " ]. Tostring (). tolower (). tolower (); viewbag. Model = Model;  Return View (model. Store. theme. viewpath + "  About. cshtml  "  , Model );}  # Endregion 

 

Childaction is as follows:

 [Childactiononly]  Public  Actionresult footer (storeinfo store ){  VaR Model =New  Storemodel (); Model. Store = Store;  If (Store. Theme! = Null  ){  Return Partialview (store. theme. viewpath + "  Footer. cshtml  "  , Model );}  Else  { Return Partialview (storeservice. getstoreconfig (). defaultview + "  Footer. cshtml  "  , Model );}} 

 

Select template in the background

This simple method is used to select multiple templates for multi-user stores. Custom second-level domain names are not described here.

There are still many imperfections in self-perception. You are welcome to make a brick.

Independent blog address: http://www.jqpress.com/post/182.aspx

 

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.