[G] Open-Source Distributed Deployment Solution (2): Open-source Deployment Solution

Source: Internet
Author: User

[G] Open-Source Distributed Deployment Solution (2): Open-source Deployment Solution
G. Series navigation

[G] Open-Source Distributed Deployment Solution-Preview

[G] Open-Source Distributed Deployment Solution (I)-Opening

[G] Open-Source Distributed Deployment Solution (2)-Good projects are reconstructed based on poor projects

Analyze the current project structure


There is such a folder that many people can't see. Yes, first of all, we need to give it away.

According to the naming intent of this project folder, it can be divided into the following:

1. Business: Business Code

2. Data: Data Access

3. Helpers: helper class (for general class libraries)

4. Models: various Models (including view Models)

5. theme: the skin, and some content and scripts should be deleted or sorted into theme.

6. Controller, Views, and DB: Don't move them.


Reorganize the project structure based on the folder name's intent


First, sort out four Solution Folders (note: the solution folder is a virtual structure and is not a real physical folder. Although the source code storage location is missing, it is based on the current layer, but this concept should be separated), namely, Business, Model, Data, and Infrastructure, which splits the Business, Model, Data, and Infrastructure.

The Business and Model folders are mainly related to the Business. The two folders will create corresponding projects, such as DeployManage and UserManage, based on the functional modules. For example, to deploy a server, deploy a server group, or deploy a project, you only need to create a level 1 folder for the corresponding project.

Data is split into two types, mainly considering that Wrapper is used for Business and is mainly used to access the database, while Entities are used to store the entity classes corresponding to the Data table.

The final Infrastructure puts some public classes here.

Someone may ask, is that simple? Is this the final project structure?

Of course not. refactoring is an action and a process. Subsequent reconstruction will be made based on the development of the project.

Problems encountered during migration

The first problem is that it, AuthenticationDescription, is referenced according to the existing namespace. The normal inference is that Microsoft. Owin. Security. dll can be referenced. But it turns out no.

In order to know why, I put this class back to its original position. F12 tracked it and looked at it. Hey, it turned out to be a li GUI.

Finally, Microsoft. Owin. dll is added. This class is actually irrelevant to Microsoft. Owin. Security. dll. It was a real joke.

2. Lei Feng, you did a good job but leave a name for it.


You may prefer to use the light bulb provided by vs. It is very convenient, but it is not omnipotent. If you follow the options here, you have two options, either create a new class to implement it, or reference System. Runtime. Remoting. Context.

Although through the above method we can also find out who is doing the good thing in the end, but at this time experience has emerged, I can see at a glance that EF has helped to expand (after all, there are many pitfalls ). It has done a good thing, but it hasn't left its own name yet. It just tells me that it is an anonymous man. The first step on this pitfall was also solved through the first method. The nature is the same, but here I want to tell you that accumulation is also very important.

When dealing with Business, I found that it could finally give A correct prompt, which is like A is B's wife and B is A C's colleague, c. Ask B to know who A is.

3. You married your daughter. She is still your daughter.


The reference relationship has been changed. In the process, all the references have been changed using the light bulb that everyone liked. Why does this problem still occur? Don't you care about the View? She was not born of you?

This is the sprinkling water. You need me to wipe your ass. This is just a joke.

After seeing this page, I breathed a sigh of relief and finally did not report an error.

Let's take a look at G. Client. UI. Admin.

But is this all done? This is just the beginning, and the road is still long.

4. Do you have no worries about acne growth on others' faces?


A good business-layer code references EF, which is really unpleasant. In addition, System. Web is referenced in the Model to obtain the UserID.

As a moral person, people have acne on their faces. You should use a speaker to yell at him: Hey, you have acne on your face. It's so big, so ugly!

Nonono, as a cultural person, will certainly solve your pain points. Instead of now, we will do it later. In fact, it is very simple. You only need to encapsulate EF operations in Wrapper so that Business does not directly reference EF-related functions. (This is the mechanism of. net)

Similarly, System. Web can be provided through Infrastructure. From then on, we will never worry about the long run of acne.

Code adjustments

As a lazy person, the first thing to solve is to free your hands.

There are many other places in the face of database operations. The assignment everywhere is really a five-finger that feels bad for me.

Many people have come up with AutoMapper? Of course, some people like EmitMapper and so on. Each has its own strengths. Let's pick up the radish cabbage. I won't talk much about the usage. Let's look at the final code. Of course, I use an AutoMapper encapsulated once again.

Even if the AutoMapper is flexible, but everyone's habits are different and there is always something you don't feel uncomfortable with, let's do it on your own.

The whole person is better.

PS: The referenced er is written by ourselves, Framework. Mapping and Framework. Caching. There is no open source yet, which will be released later. In fact, there is no shell obfuscation. If you are interested, you cannot help it.


Next announcement: [G] Open-Source Distributed Deployment Solution (III)-deployment project management (take Jenkins as an example to prepare the deployment package)

Finally, the project is named G, with the unique group number: 7424099.

Git address: http://git.oschina.net/doddgu/G (hope you can pick up a star, thank you for your support)

Related Article

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.