Do a small function with MVC5+EF6+WEBAPI (iii) Project construction

Source: Internet
Author: User

Generally a project before the start will have a start meeting, demand disclosure and so on, which will have a link, big talk about the meaning of the project, and then take a tall on the project name, we this is a small function not project, but the name can not be too stingy. Well, it's called Trump. Don't have any meaning, play!

Project hierarchy also to say here, this small function in the style of the DDD hierarchy, I must remember that I said is modeled. Because I don't know ddd, I paint a skin.

DDD This thing Chinese name should be called field-driven design, the garden many great gods have shared, explained. Read a lot of blogs a lot of books, still do not understand so complicated things (no practice, the end of the paper is shallow). Here to simply say their own understanding, the business logic as far as possible to focus on the domain layer (domain), if the project is the human body, that domain layer is the human brain, to the current technology, body parts in addition to the basic brain can be replaced. It may be possible to change the brain to another person, but the whole body still listens to the brain's command. If the body does not have a brain, basically is a beach of meat, lost as the body function.

In addition, as a body, is still far from the computer to achieve the same low coupling, so most parts replacement cost is very high. Even if it is a computer, to replace the parts is to take into account the overall platform architecture and so on, so when it comes to low coupling, can be replaced when not helpless case, the probability of use is very small.

An example of a project, such as the introduction of work units, the concept of storage layer, is to isolate the field and data persistence, but the real project on-line, to replace the layer of data persistence is not easy. based on the project's existing application scenarios, and then the technology selection, to develop the efficiency, development costs, scalability, maintainability and so on, not what is on the tall on what, what concepts are to be involved, that will only become a technical point piled up and difficult to use practical.

For example, we this project, is a small function, now can be estimated user volume is you and I he, you have to consider millions user's extension before the line is not formed, it is estimated that the project will never be online.

Technology is not good or bad, only suitable for not! Of course, PHP is the best language, this is the world truth!

A common language that can be understood by a domain expert, designer, and developer as a tool of communication, discovering domain concepts in the process of communication, and then designing these concepts into a domain model;
The domain model-driven software is designed to implement the domain model by code;

Therefore, the core of domain-driven design is to establish the correct domain model

To learn more about the concept of ddd you can open the link above, including the image below, which is also glued from the article, where we just use his layering and do not practice DDD.

A classic layered architecture for domain-driven design

Layering of small functions

Our small project is divided into four layers, respectively,

    • Trump.domain main storage model, do not reference any project
    • TRUMP.EF implements data persistence, the EF6 is used in this case, so there will be a lot of EF CRUD implementations, depending on the domain project
    • Trump.application enables data to interact with the UI, data that is processed by EF is transferred at this level to DTOs back to the UI layer, relying on domain, EF project
    • Trump.examapp UI layer implementation, built using Mvc5+web api+jquery+bootstrap, relies on domain, application layer.

The general project will also have a Help class project, provide some common method encapsulation, extension method, etc., not as any project unique, so here is not listed.

Create a solution and create a project (Vs 2017)

Come on, come on, create a new blank solution, and add the MVC project, called Trump.examapp, which is very basic, just a list of notes.

1. Select the ASP. NET Framework, which is the legendary cross-platform version. Relatively outdated, watched a few videos are the first few episodes.

2. Select MVC and check the Web API (not checked and can be added via NuGet), where authentication is not authenticated. ()

Authentication:

Do not authenticate: Do not use Net-brought identity management

Individual user accounts: integrated with the ASP. NET Identity v2 (. NET Framework) or v3+ (. NET Core) version

3. Once the creation is complete

4. Using NuGet to manage references in projects

Right-click on the project to manage the NuGet package and remove "microsoft.applicationinsights". Application Insights is a scalable application performance management (APM) service that enables WEB developers to build and manage applications on multiple platforms. Not available for the time being, but the package has several, habitually removed, and then upgrades all packages except jquery.

Note: Because of compatibility issues, the jquery version should not be changed randomly

All right. To this end, the project is basically complete, followed by the creation of several other projects in the name of the contract, with the choice of type Class library (. NET Framework).

Once created, refresh and build the solution. Set the Web project as the startup Project, F5 start debugging, our entire project shelves are basically built.

Do a small function with MVC5+EF6+WEBAPI (iii) Project construction

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.