E-Book Overview
Syncfusion Inc., 2015. — 108 p.
Familiarity with code generation tools is key for modern software engineers, and whether you know it or not, you’re probably already using one. In T4 Succinctly by Nick Harrison, you’ll learn what goes on behind the scenes during code generation with T4, Visual Studio’s built-in code generator. Then, use those principles to apply metadata to a template and transform it into source code in a variety of languages.Topics included:IntroductionGetting StartedRun Time TemplatesWorking with the HostIt’s All About the MetadataWorking with SQL Server MetadataWorking with ReflectionWorking with Code Model
E-Book Content
1 By Nick Harrison Foreword by Daniel Jebaraj 2 Copyright © 2015 by Syncfusion Inc. 2501 Aerial Center Parkway Suite 200 Morrisville, NC 27560 USA I All rights reserved. mportant licensing information. Please read. This book is available for free download from www.syncfusion.com on completion of a registration form. If you obtained this book from any other source, please register and download a free copy from www.syncfusion.com. This book is licensed for reading only if obtained from www.syncfusion.com. This book is licensed strictly for personal or educational use. Redistribution in any form is prohibited. The authors and copyright holders provide absolutely no warranty for any information provided. The authors and copyright holders shall not be liable for any claim, damages, or any other liability arising from, out of, or in connection with the information in this book. Please do not use this book if the listed terms are unacceptable. Use shall constitute acceptance of the terms listed. SYNCFUSION, SUCCINCTLY, DELIVER INNOVATION WITH EASE, ESSENTIAL, and .NET ESSENTIALS are the registered trademarks of Syncfusion, Inc. Technical Reviewer: Matt Duffield Copy Editor: Courtney Wright Acquisitions Coordinator: Hillary Bowling, marketing coordinator, Syncfusion, Inc. Proofreader: Morgan Cartier Weston, content producer, Syncfusion, Inc. 3 Table of Contents The Story behind the Succinctly Series of Books .................................................................................. 7 About the Author ......................................................................................................................................... 9 Chapter 1 Introduction ............................................................................................................................. 10 Introducing T4 ........................................................................................................................................ 10 Why Generate Code? ............................................................................................................................ 11 Actual Applications ................................................................................................................................. 11 Practical Applications ............................................................................................................................. 12 Minimal Requirements ........................................................................................................................... 12 Summary ................................................................................................................................................ 13 Chapter 2 Getting Started........................................................................................................................ 14 Two Types of Templates........................................................................................................................ 14 Adding Templates to Projects .......................................