This project is developed using Asp.net MVC 2 + Castle + Entity Framework.
The following describes the project structure:
First of all, I will not talk nonsense about the entire solution.
1.
Database: sqlserver2008 is used here
2.
Cache Design: to reduce the pressure on the database, cache the data that does not change in the short term on the page, thus reducing access to the background database. This uses the cache module in the Microsoft Enterprise Library.
3.
MVC Framework Design: MVC is an important architecture of the Web application front-end. Most of the content of website interaction will be concentrated in this part, an efficient and easy-to-expand MVC framework is an important component of the entire website.
The data entity is the data entity generated by Entity Framework:
There are many tables, and I do not like Relational Data Operations (it is easy to query and maintain). Therefore, data associations without creating tables seem messy.
Data Access uses the repository mode. Most MVC projects currently use this mode (such as oxite,
). I will introduce it in the next article.
4.
SEO (Search
Engine optimize) solution: Provides website search optimization solutions for search engines.
Here we mainly process the keywords and descriptions of the page.
First define a abstract Controller base class, which defines some websites
SEO fields:
Public abstract class BaseController: Controller, ISiteProvidesBaseService
{
//
// GET:/Base/
Private IBaseControllerService _ baseControllerService;
# Region ISiteProvidesBaseService Member
Public IBaseControllerService BaseControllerService
{
Get
{
Return this. _ baseControllerService;
}
Set
{
_ BaseControllerService = value;
ViewData ["Page_Title"] = _ baseControllerService. ShopName;
ViewData ["Page_Description"] = "\" {0} \ "". With (_ baseControllerService. PageDescription );
}
}
# Endregion
Public String message {set {viewdata ["page_message"] = value ;}}
Public String title {set {viewdata ["page_title"] = value ;}}
Public String keywords {set {viewdata ["page_keywords"] = value ;}}
Public String description {set {viewdata ["page_description"] = value ;}}
Public Virtual void withtitle (string value)
{
Viewdata ["page_title"] = "{0}-{1}". With (viewdata ["page_title"], value );
}
Public Virtual void withdescription (string value)
{
Viewdata ["page_description"] = "{0}-{1}". With (viewdata ["page_description"], value );
}
}