Summary of "Beef Brisket" backstage Code completion

Source: Internet
Author: User

Beef Brisket has been learning for almost two weeks, and finally the backstage code part of the completion, see the speed is very slow, but through the video to learn a lot, there are skills and knowledge, the teacher explained to us very carefully.

A trick aspectUse of tab after 1.if

If you need an if statement, you just have to press the TAB key twice to automatically show the if statement segment, so that you don't have to lose the parentheses and curly braces, It saves time and improves efficiency.

2. Put the duplicated code in the Toolbox for backup

Repeat the selection, and then open the Toolbox fixed, you can directly drag the duplicate code into the Toolbox, and then rename, and later when the use of the direct drag out to the appropriate location, it is convenient to a lot. The last of the following:


3. Insert External code #region

The code of the comments is a very important thing, your own code may be understood, but how to let others see also immediately understand, so that the role of the comment is highlighted, the beginning of a method we comment on the time only to knock three slash "//" will automatically appear on the method of comments, it seems very convenient, But if we fold up the annotations and methods, we don't see what the notes are, and the final effect is this:

It seems simple to look at, but I don't know what the comment is, so it's not immediately possible to know what it is like to look at the code, which will affect the development of the project. So insert the external code #region, in the menu bar select Edit--intellisense--Insert code snippet, of course, you can also use the shortcut key ctrl+k+x, so that in the code will appear "insert code Snippet", then select Visual C #, then select #region, Finally, you can change the myregion in the code to the comment content. Such as:



Let's look at the final effect, how, so it doesn't look particularly comfortable. It is really fun to learn this skill ~

4. Make your own template

We are in the new class or form to be preceded by a comment, and the basic format of the note is certain, the first time the machine room is knocked over and over the same content, looked at the beef brisket before you know you can set up a template, so that a form or class can automatically generate the comments you want.

How to make: Find the installation path VS, in my case, looking for D: \ Learning Software Installation \vs\common7\ide\itemtemplates\csharp\code\2052\class\ Class.cs, then use Notepad to open, edit, write your own comments in front of the save, refresh in VS, add class. You can generate a template of your own.

two knowledge aspects1. Code Writing Database

<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" >--CREATE DATABASE newssystem--Create a Category table create TABLE category (  ID int identity (primary) key,--self-increment, and the primary key, The identity represents an increment, starting at 1 increments of 1  [name] varchar (NOT NULL)--Creating a news Table CREATE TABLE news (ID int identity (primary) Key,title V Archar (+) not null,[content] text not NULL, createtime datetime not null,caid int)--Build Comment table CREATE TABLE comment (id int ID Entity (primary) Key,[content]text not null,createtime datetime not null,userip varchar (all) not null,newsid int) </s Pan>

Computer room When I heard that can code design database, but at that time just heard not to understand, looked at the beef brisket to know that the original code to design the database, through the comparison I think the code is relatively easy to write.

2. Parameterized queries prevent SQL injection problems

This previous blog has been discussed, see blog: click here.

3. Triggers

When a content modification is done with multiple other actions at the same time, and does not have to think about its execution, the system is automatically based on the code we write, the trigger implements cascading changes to related tables in the database, and these changes can be executed more efficiently through cascading referential integrity constraints.

4. Stored Procedures

a set of SQL statement collections that complete specific functions, and modules written by Process Control statements that are compiled and stored in a database server-side database, which the user executes by specifying the name of the stored procedure and giving the parameter (if the stored procedure has parameters) . Most of us have used it in the machine room, and a lot of stored procedures have been used in the brisket, and any well-designed database application should use the stored procedure. It can reduce a lot of code volume. And in the video, the teacher also introduced the use of the Query Designer method, so that the code of the stored procedure can also be generated automatically, after the generation can also be modified as needed. (PS: Query Designer by clicking on the query--in the editor to design the query, you can find, according to the need to select the table, fields and additions and deletions to be made to change the method)

5.sqlhelper

This time in the computer room has been contacted, but by looking at other people's blog through the use of understanding the line, do not know how to step by step abstract into such sqlhelper. The Beef brisket video gives us a very detailed explanation of the process of abstract sqlhelper, which starts with test, and then adds a stored procedure that merges gradually into the final appearance. Feel the teacher explain very meticulous, but oneself feel still not familiar, library code also need to use sqlhelper, hope through this practice, oneself really can have a deeper experience.

Three summary:

Feel the video in the teacher to explain the special meticulous, at the same time realize to pay attention to special concentration, otherwise you can because of that one second missed the particularly important content, sometimes have to go back to listen to duplicate content. In this video learned a lot, summary is also a review process, so you can know where you learn the lack of. At present, I think of these contents, if there is any mistake or what the partners have to add, welcome to ask.

To speed up, the later content will be more exciting, there will be more errors waiting for me, waiting for themselves to grow.


Summary of "Beef Brisket" backstage Code completion

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.