Devtext Design)

Source: Internet
Author: User
Tags visual studio 2010

Not here for a long timeArticle. I recently took the time to participate in the overall design of a blog publishing system, so I hope you can make a picture. In addition, I am very much looking forward to coming in to lead us to complete this project.

Brief design description of devtext

I. Development Environment:

Visual Studio 2010

SQL Server 2008

Asp.net MVC 2

Ii. project design purpose:

The project aims to enable you to have a good Chinese blog publishing system. At the same time, we can learn some new technical usage and design patterns through this project.

The final blog system will be a system with high scalability and fault tolerance.

Iii. architecture of the entire system:

The bottom layer is the Asp.net and. Net frameworks, which are the tools or frameworks we will use.

Asp.net MVC is a good web development platform that makes the entire web system structure clearer.

Nhib.pdf Is An ORM tool. Compared with EF, it is more mature and has better performance. Therefore, we choose it as An ORM tool, which allows us to access the database flexibly and quickly.

Autofac is a useful IOC container. It is used to make it easier for our entire project to be modified in the future maintenance phase.

Microsoft. Data. entity. CTP uses it mainly to create data models and databases in the 'code-First 'mode. Instead of the traditional mode, you must create a database before it can run.Program.

Devtext frameworkSome introductions:

This part is the core module of the entire project. The interfaces used by all modules are defined here. It is the dependent module of all widgets. Besides all interfaces, cache management, system settings, Log Module, error processing module, MVC extension, Theme Management, widget management, viewengine extension, and MVC extension.

The entire framework is divided into three parts, as shown in.

On the left is the extension function of Asp.net MVC, such as action processing, controller extension, and route extension.

The intermediate part can be divided into two parts: the logs of the entire system, error processing, Cache Management, background task management, and system settings. The other part is the main interface part. ientity, irepository and unit work are the core of data access.

There are several management modules on the right. Skin, widget, email, script, etc.

The following section describes how to implement each module.

1. Implementation of the cache module.

The cache mechanism provided by Asp.net is good, but we need to extend the cache mechanism of Asp.net to make it easier to test the entire cache module.

A good example is recommended here:Http://weblogs.asp.net/pglavich/archive/2010/10/13/caching-architecture-testability-dependency-injection-and-multiple-providers.aspx

Write this partCodeYou are advised to refer to the above article or integrate it into the project.

2. Log Module. We recommend that you use the logging facility in Castle. Windsor in combination with a good logger project (for example, log4net.

Example:Http://stw.castleproject.org/Windsor.Logging-Facility.ashx

3. handleerror Module

We have previously recommended using elmah to record system errors. Every good system must record system errors during user access to facilitate future system improvement.

Elmah is a tool I recommend for recording errors at 100. Note that the log and errorhandle modules are differentiated here.

4. Setting Module

The blog name, logo, number of records displayed on each page, and skin settings must be completed in the setting module.

5. validation module:

In many classes or methods, you need to first verify whether the value is null. Then, we put the method with the verification value empty in the validation module and set it to the static type. This facilitates future verification.

6. navigation module

This module is also the menu part of the blog background management. The expected result is that after I add a widget, you can set the display position of the widget in the blog background management menu.

7. Task Module

Sometimes many blogs are released at a certain time, so a task module is required to process the release time.

8. iwidget Module

Widgets are designed to make the system more scalable. Therefore, in the Framework section, we only define its interface iwidget, which mainly contains the widget name, author, version, and view its permissions. Each widget inherits it. Each widget can be a separate project. The display content of the widget is completed through the Controller part in the widget.

9. ientity, irepository, iunitofwork

Previously, I said that I want to separate the data access part from the entire framework. Therefore, in the framework, we only define these interfaces, and the data access part will be a separate project.

The advantage of doing so is that some people may want to use Nhibernate for ORM tools, and some may want to use Entity Framework.

Refer:Http://www.n-pei.com/blog/devtextdesign1

The following section describes the management module.

10. Email Manager Module

After a user registers, he or she should be able to receive an email, forget the password, and reply to the comments. Therefore, this module is a basic module.

The folder contains a template file (.txt file ).

11. filemanager Module

This module mainly determines the file type. For example, we require that only JPG, PNG, and GIF images be uploaded, when the user uploads an image of another type, it is unacceptable. format. And the link for downloading files, as long as the common methods involving file and image operations can be put here.

12. scriptmanager Module

The main function of this part is to easily add the jquery part to the page. (There is no good idea .... --!)

13. thememanager Module

The themmanager module can find all the theme paths and some theme interfaces. core is used to implement theme. themanager provides some basic interfaces.

14. widgetmanager Module

The management module of the widget Extension function uses the Extension Manager framework to implement the import function. It can scan the directory where the widget is located and encapsulate the DLL in each widget into a new DLL. Maps to the bin directory. Is a core module.

The following sections are related to MVC:

15. MVC extension module:

All extensions are stored here, including htmlhelper extensions and controller extensions.

16. Action filter module

Reference: 1) Http://aleembawany.com/2009/03/27/aspnet-mvc-create-easy-rest-api-with-json-and-xml/
2) Http://weblogs.asp.net/omarzabir/archive/2008/10/03/create-rest-api-using-asp-net-mvc-that-speaks-both-json-and-plain-xml.aspx
3) Http://www.alexthissen.nl/blogs/main/archive/2008/07/01/health-monitoring-action-filter-for-asp-net-mvc.aspx
4) Http://www.codeproject.com/KB/web-cache/mvcresultcache.aspx
5) Http://www.singingeels.com/Articles/Logging_with_ASPNET_MVC_Action_Filters.aspx
6) Http://kigg.codeplex.com
7) Http://www.iansuttle.com/blog/post/ASPNET-MVC-Action-Filter-for-Localized-Sites.aspx

Mainly for some extended applications of Asp.net MVC action filer

17. Action result Module

You can customize some actionresults, such as file download customization:

Refer:Http://haacked.com/archive/2008/05/10/writing-a-custom-file-download-action-result-for-asp.net-mvc.aspx

Http://john-sheehan.com/blog/another-asp-net-mvc-custom-actionresult-example/

18. Command and commandbinding modules

It is mainly used to expand the model binding module of Asp.net MVC. Refer:

Http://www.hanselman.com/blog/IPrincipalUserModelBinderInASPNETMVCForEasierTesting.aspx

19. appcontroller Module

All controllers inherit this basic controller, which inherits the default controller of Asp.net.

Devtext. CoreSome design instructions

The Framework section of devtext is introduced above, and the following section is the core module section.

What is the core module? Core is the basic module (s) for the normal operation of the entire Blog system, such as navigation, homepage, localization, XMLRPC, feed, blog, comment, and dashboard.

WidgetExtensions

The last part is our widget extension, which includes archive, Tag, search, personal information, and exercise information.

Every widget is created as an empty Asp.net MVC Project, for example:

You can add new widgets later.

 

If you are familiar with nhib.pdf, Asp.net MVC or jquery, please join the QQ group: 111497879 or send an email to: nic162534@gmail.com

 

Nick

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.