Welcome to YLOAN.COM
yloan.com » Web-Hosting » ASP.NET 4.0 Hosting :: Generating Code Using Visual Studio 2008 and 2010
Online Business Site Promotion Web misc Affiliate-Revenue Auctions Audio-Streaming Autoresponders Blogging-Rss Email-Marketing Ezine-Publishing Forums Internet-Marketing List-Building PPC-Advertising Podcasting SEO Spam-Blocker Traffic-Building Video-Streaming Web-Design Web-Development Web-Hosting Domain Name soreness web analysis vinyl mlm searching media info spyware access microsoft outlook farmville

ASP.NET 4.0 Hosting :: Generating Code Using Visual Studio 2008 and 2010

ASP.NET 4.0 Hosting :: Generating Code Using Visual Studio 2008 and 2010


Microsoft included its T4 generation language in the box in Visual Studio 2008 and added important new features in Visual Studio 2010. Visual Studio 2010 makes generation easier to find and supplies a powerful new feature called preprocessed templates. Code generation lets you automatically create significant portions of your application. It has the potential to decrease bugs and increase your ability to alter code across your application as needs change. Microsoft's generation language is T4 and it is included in the box starting with Visual Studio 2008. Visual Studio 2010 makes T4 easier to find and supplies a powerful new feature called preprocessed templates. I'll show you how to use T4 in Studio 2005 and beyond.

Microsoft's code-generation tool emerged from the DSL Toolkit. DSL stands for Domain Specific Language and code generation transforms information written in a DSL into a .NET language, which creates the run-time artifact for representing the DSL. While I won't cover DSL in this article, aspects of T4 are easier to understand in connection with this perspective. When you have time to explore it, the DSL Toolkit provides a nice visual DSL, particularly in Visual Studio 2010. Oslo will provide a textual DSL. This article discusses using the T4 generation language outside DSL to generate portions of your applications.

We'll show the generation language itself, and then return to cover a few approaches to executing templates and which portions of your applications are most likely to benefit from generation.


Starting Out with T4

T4 stands for Text Templating Transformation Toolkit. If you're running Visual Studio 2005, you'll need to download and install the DSL Toolkit to have T4 available. If you're running Visual Studio 2008, T4 is already on your box, although it's well hidden. Visual Studio 2010 includes T4 in the Add Item dialog. The T4 language is very similar in all of these versions of Visual Studio. T4 is part of Visual Studio, not the .NET Framework because it's a design-time tool.

Generation is a transformation process. You take some sort of template and some sort of input data and create a new file as output. The input data is called metadata. The output file can be anything-including documentation, configuration, and code files such as C#, Visual Basic .NET, or T-SQL. You can create one or many files depending on the capabilities of your tool. With the default Visual Studio behavior, T4 has limited metadata capabilities and outputs only one file per template.

To create a T4 template in Visual Studio 2005 (after you've installed the DSL Toolkit) or 2008, create a text file and save it with a .tt extension in a Visual Basic .NET or a C# project. If you're working in Visual Studio 2010, select Text Template in the Add Item dialog. Visual Studio provides a default custom tool based on the file extension.

To create your first template, type the following into the editor window:

//Hello World

When you save, you'll find a dependent file created with a .cs extension. The dependent file appears as a child node to your template file. If you can't see the dependent file after saving, select "Show All Files" at the top of Solution Explorer. You can also right-click and explicitly run the custom tool. The dependent file created from the template above contains the single Hello World comment.

If you're using Visual Basic .NET, you'll need to specify the output extension, change the comment character, and then select "Show All Files" in Solution Explorer to find the dependent file:

'Hello World

All current versions of Visual Studio offer only a "Notepad" editing experience for T4-no code coloration and no IntelliSense. In Visual Studio 2010, you can download the Tangible T4 Editor from Tangible Engineering. In earlier versions, you can download the Visual T4 Editor (professional or community edition) from Clarius Consulting. Thanks to both companies for offering free versions to get you started.

All code-generation templates interleave code that represents the logic of the template with the output code. Good editor support is essential to distinguish these two types of code, especially in the common case where both languages are the same.

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we've put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life -ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There's no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site

- 99,9% Uptime Guarantee - ASPHostDirectory promises it's customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people's uptime for them called ASPHostDirectory Uptime

- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers

- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service

- Money Back Guarantee - ASPHostDirectory offers a no questions asked' money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund


- Experts in ASP. Net 4 Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory

- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it

- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control Panel in 1 minute!

Happy Hosting!
What is VPS Web Hosting? Why Should You Be Choosing VPS Web Hosting? Find the Best VPS Web Hosting Unlimited Web Hosting: Top Benefits of Unmetered Web Hosting Learn About Virtual Private Server Host As Well As Usefulness for Company Best Web Hosting Solution: Changing Providers How To Pick a Good Web Hosting Company How India Based Web Hosting Company Can Be Much Profitable? How Important is a Dedicated Web Hosting? Ipage hosting is the best cheapest hosting How to find out if you need a dedicated server How to mount Exchange public folder store in Exchange Server 2003 Web Hosting Speed, Price And Reliability - Which One Should Come First?
print
www.yloan.com guest:  register | login | search IP(216.73.216.114) California / Anaheim Processed in 0.049257 second(s), 7 queries , Gzip enabled , discuz 5.5 through PHP 8.3.9 , debug code: 54 , 7792, 242,
ASP.NET 4.0 Hosting :: Generating Code Using Visual Studio 2008 and 2010 Anaheim