MVC+HUI+SQLSUGAR+AUTOFAC+NLOG+T4 Architecture Design (i)

Source: Internet
Author: User
Tags aop log log

First, preface

As a rookie of the first blog I was a little excited, recently began to start writing a structure of their own. Calculate down more than recently spent more than a week out of work time to write this framework, originally wanted to complete the development of the overall framework after the completion of the test to write a blog, afraid of their own no time or lose power, first put their own architecture design to share, the next chapter I will be the overall code published, the overall code.

In the beginning to build the framework, the first consideration is the simple and lightweight structure is clear, the building is mostly by their own imagination to design, which also has the reference of Daniel, no matter how it is, this is also the upgrade of their technical ability (from small rookie to rookie process, ^_^) believe that they will do better. I also hope that Daniel and the big bulls of the guidance. Don't scold small rookie yo, my small heart is very fragile oh! O (∩_∩) o haha ~ nonsense not much to say, began to enter the theme.

Second, the structure diagram

  

This project is the framework of RDF's overall architecture, in each layer of the module is written only the basic structure, simply marked their relationship, detailed will be described below.

  

Is the schema diagram of RDF in the project.

Third, the overall structure of the description

  Now start with the introduction from the bottom up:

    1. Infrastructure (infrastructure layer)

RDF. Infrastructure: This class library provides the underlying core functionality of the overall architecture, primarily for data-related operations such as databases, caches, MongoDB, and so on. Here ORM Framework I use is Sqlsugar, very lightweight an ORM framework, we are interested can also go to the official website to see. This provides common methods and caches for public warehousing, which provides the characteristics of an AOP transaction interceptor. No business code is written here, only a call to the core base module is available, which can be called in a separate wrapper for the DLL.

    2. Domain (Business Core layer)

      RDF. Domain: This class library is primarily used for the most basic business logic. Here mainly with large modules and small sub-module development, sub-modules mainly to achieve the infrastructure layer of the public method of warehousing, each small module can also achieve their own method logic. And the large module is actually used to deal with the logic of business, but here to achieve the core business, where operations will be called to many sub-modules according to business complexity, if you want to modify a functional module in the future do not need to modify the submodule, only need to find the corresponding business module (main module) to modify, the main module is the processing of business The module range can be divided according to your own needs.

    3, Application (Application layer)

      RDF. Web.app: This class library mainly handles the core business two times, which is mainly to accept the presentation layer of data for HTTP-related processing, such as Webfrom or MVC or API calls, and then passed to the core business class, according to the operation of the core business to respond.

    4. Common (public Facilities level)

      4.1, Rdf.common: This class library mainly for the entire project to provide public operation method, and log log record, here I use Nlog, provides the log interceptor features, as long as the label can record the method may occur the exception, equivalent to the previous exception capture and processing, The processing here only needs to be labeled enter a message that may throw an exception and store it in the database and log text, which can be stored according to the configuration, and can also record what time the method was developed, so that maintenance personnel could be found for maintenance. (Note: The log features and transactional features here are all using the Dynamic interface AOP.) )

      4.2, RDF. Model: This class library provides database entities and other definitions, where entities are generated using the T4 template.

    5. Presentation (Presentation layer)

    RDF. Mvc.site: The site's presentation layer, configured with AUTOFAC for dependency injection and AOP operations.

    Iv. Summary

    This project structure is only the original version, in the next chapter open source, with the authority of the framework for the completion of the goal sharing, in the code step-by completion and testing, the subsequent framework unreasonable part will be rewritten, the schema and the code is perfect will write T4 to generate the schema.

MVC+HUI+SQLSUGAR+AUTOFAC+NLOG+T4 Architecture Design (i)

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.