Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
In Visual Studio 2010 Essential Training, author Walt Ritscher demonstrates how to use Visual Studio 2010 Professional to develop full-featured applications targeting a variety of platforms. Starting with an overview of the integrated developer environment, the course covers working with code editors, navigating and formatting code, and deploying applications. Also included are tutorials on running performance and load tests, and debugging code. Exercise files accompany the course.
Often, when writing your application, you will come across large areas of boilerplate code in which the same code pattern is repeated over and over. Whenever you find yourself repeating the same mindless task, you should consider automating the process. The good news is other people have considered this problem before you and have written code generation tools. Code generation is where software-- rather than a human--is used to write program components automatically. A number of commercial and free code generators are available in the market. Visual Studio uses generators in many of the UI designers.
They have the drag-and-drop designers generate the XML or code. Another popular use of code generators is in object relational mapping tools, or ORM. ORM tools take the tables and other constructs inside a database and turn them into language objects. There is an active community of third- party vendors making code generation tools. Here is a list of some of the code generators on the market. The most common pattern I see is for code generators is the following: You create a template file, which contains your portions of your code.
The template file also contains tokens. You take your template file and you pass the template file to a generator. Optionally you pass other external parameters to the generator--say a database connection string. Here is an example, on the bottom of this slide, of a token from CodeSmith. This has an angle bracket, a percent, a word called current time, and then the closed percent and close angle bracket. This will tell the code generator to calculate the current time and place it in your code template at this point.
When you run the generator, you'll pass in parameters. Some of the things you might pass in are connection strings to open the database, evaluate database schemas, find files in your hard drive, or read information from your UI tools. Then the code generator will replace the tokens with the runtime information. Visual Studio has a code generator, known as T4. I would like to show you how that works, and it's the topic of the next movie in this chapter.
Find answers to the most frequently asked questions about Visual Studio 2010 Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.