ASP. net mvc + EF framework + easyui permission management series (10)-VSS source code management

Source: Internet
Author: User

ASP. net mvc + EF framework + easyui permission management series

(opening) (1 ): (2 ): database access layer design demo (3 ): interface-Oriented Programming (4 ): encapsulation of the business logic layer

(5): jquery easyui implementation at the front end(6): EF context instance Management(7): dbsession Encapsulation(8): unique in the dbsession thread 

(9): Learning TT touch Edition

In the previous blog, we briefly described the T4 template.Source codeManagement, of course, these knowledge points are just a simple reference. If you need to learn in detail, you can find a lot of things you need in the blog. Next we will start to learn the source.CodeManager. What I want to talk about here isVSS.

1. Why source code?

(1) first, you may encounter this problem. We have been working on a project for a long time, but at the end of the project, there was a problem (which could not be solved ), at this time, we very much hope that the project will be able to return to when we can run, and we have been working on the project for a while, one day, we thought that the code we wrote was a bit problematic and could be implemented in a simpler way, at this time, we want to quickly return to the place where we want to modify or re-run, which is the role of the source code manager.

(2) Therefore, the source code we write must be well managed using a very good tool, and good rollback can be performed when there is a problem with our code, rolling back to a certain time point of a day, that is to say, all the source code of our development project must be managed. It cannot be said that it is not safe to exist on our computer, if there is a problem with our system hard drive, this is the loss of the entire project.

2. Introduction to source code Manager (VSS)

(1) The above description shows that we want to manage the source code. How can we manage the source code? Below I will draw a picture to describe it,

(2) Based on my belief that we can see how the source code manager executes and how it completes these tasks, I will introduce some things that are not written in the following.

(3) what our developers require in the source code manager is to use the check-out file and check-in file. What is the check-out file?When I want to modify this file, I need to check out the file on the server first. After the file is checked out, I can modify it. After the file is modified, it is generated successfully, when submitted to the server, it is the check-in, which is the difference between the check-out and check-in.

(4) Next I will demonstrate how to use the source code manager for the permission system we are developing. For more information, see

3. Install the source code management software VSS

(1) After the above introduction, we want to manage the source code, but how can we manage it? Of course, the first thing we think of is that we need an environment, that is, the installation of the VSS tool. First we open Visual Studio and then clickTools> Options> source code management,:

(2) For example, we will see a drop-down box for the current source code management plug-in the source code management. If VSS is not installed, there should be only one Visual Studio team foundaton server, if VSS is installed, the effect will be the same as that of me.

(3) If VSS is not installed, find a VSS software online orSend me a message and I will send it to you.Then, find the setup.exe file for installation. I will not talk about the installation steps here, after the installation is complete, close Visual Studio and restart Visual Studio. Then, you can see the following in tool> Options> Source Code Manager.

(4) After installing VSS, You must select the Microsoft Visual sourcesafe option in the current source code management plug-in the tool, next we will start to build the source code management step by step.

4. How to add a project to the source code server (VSS)

(1) How can we add my current project to the source code management server? First, use the mouse over the solution.Right-click to add solution to source code management (or choose File> Select Code Management> Add solution to sourceGenerationCode Management), open:

(2) Add a wizard for source code database management, which is equivalent to adding a database, and then click Next ,:

(3) We can see two options: connect to an existing database (connect to an existing database ). The other is create a new database (create a new database). What are their differences? Let me talk about it a little bit:First, if we select connect to an existing database and click Next, we will go to another page. Where can we choose a source code management library on our machine, if it is a LAN, write the loaction address as follows:\ \ kencery. iniFile, or you can click Brower to select. However, because it was the first time we used the VSS management tool, we chose to create a new database and then click Next:

(4) It means: Where can we place the database? Click Browse and select a path (normally we can put it on disk C), and then click Next, A text box named again for the database will appear. Select default and click Next:

(5) We can see two more options. They are two available modes,The first Mode means lock-Modify-Unlock mode (that is, only one person can be modified at a time ), the second mode means copy-Modify-merge mode (multiple people can modify the file at the same time). Generally, we can select the first mode by default,Click Next and click Finish. The VSS logon page is displayed when you click Finish:

(6) It shows that we have created the source code management database, and the password does not exist by default. The user name system automatically retrieves the user name of the computer, and then click OK. The following page is displayed:

(7) then click the OK button and a prompt will be displayed.A piece of information says that we have not changed the Directory and whether to create this directory, we choose yesAt this time, we submitted our current solution to the database for management. In this way, we will add our project to the source Manager.

(8) When we add our project to source code management, a lock is displayed in front of our project, if there is a small lock, it means that our current project is managed by the source code manager. At this time, you can see a lot of files under the selected folder.

5. Use the source code server to modify the project code

 (1) After the summary above, our source code has been managed by the source code manager. At this time, we create a new controller logincontroller. CS. At this time, there is no small lock in front of the controller, but there is a plus sign, which indicates that this project is newly added, and then right-click the logincontroller controller and right-click it to check in the source code manager, the front is changed to a small lock. At this time, we modify logincontroller. CS code.

(2) When we give logincontroller. when a comment is added to the CS project, the front of the controller class becomes a red pair. When you move the cursor up, the Controller class is checked out to me in an exclusive manner, this Code indicates that our controller class has been checked out. At this time, no one else can check out this file, only when I have modified this controller class and checked it into the source code manager can I check it out.

(3) After modification, We must generate a project. If there is no problem, we can check in the Controller class, right-click the Controller class you want to check in and select Check in, as shown in:

(4) For example, it is the content when I check in the login controller. Here, we usually write comments so that we can check what has been done. Finally, click check in, after the completion, a small lock appeared before the corresponding controller to prove that we checked in successfully. The same is true for check-out. I won't talk about it here.

(5) The above is a simple description of check-in and check-out. It is actually very simple. It's nothing, as long as we understand what check-in and check-out mean,Checking out is equivalent to telling the source code server that I want to modify this file in an exclusive way. Checking in is equivalent to re-submitting the modified items to the source code server.

6. Use the source code server to perform project code rollback management.

(1) At this time, we are modifying the login controller for the second time, embedding it in the source code server again, and writing comments.

(2) then we roll back to the second modification, so how to roll back? Similarly, we right-click the login controller and choose view history, A small form that allows us to enter where and where is displayed. By default, click OK directly ,:

(3) if all the modification records are displayed, first 1 is what we created at the beginning, and 2 and 3 are what we modified and then rewritten the checked-in content, as we can imagine above, we can see our check-in information, and then there is a diff (comparison) on the right side. We select the second check-in content and then select diff. the pop-up form defaults, click OK to see the difference between the current code and the second one ,:

(4) How can we roll back to the second changed project? We can see (2) there is a rollback in the figure, but if we roll back, we won't be able to roll back, therefore, you should pay special attention to the operation. When you click rollback, there will be a prompt message. Don't worry, click yes directly. At this time, our project will be rolled back to the first time.

7. Summary

(1) through the above introduction, we found that the several problems we raised at the beginning of our blog have been solved. This is the benefit of source code management.

(2) In the next blog, we will start to analyze and explain the permissions. I will start writing about user logon tomorrow. I hope you can support it. Your support is my motivation. Thank you, at last, it was very late for us to see a new figure. We must fly to the distance like an e.


VSS software installation package: Consumer id = 382444 & UK = 856815276

KenceryReturn to the beginning of this series


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: 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.