Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Contents tagged with T4

  • Using .Net 3.5 and C# 3.0 features in T4 templates

    The T4 templates are compiled against .Net Framework 2.0 by default and it will be restricted to use LINQ and other .Net 3.5 features in your T4 templates.  If you want to use any of C# 3.0 or .Net 3.5 features in your T4 templates, you have to specify T4 templates language attribute is C#v3.5 instead of C#. The .Net 3.5 features are using System.Core namespace so that you have to give reference to System.Core namespace in the T4 templates.

    The below is the syntax

  • ASP.NET MVC Tip: Add a new T4 template for making MVCContrib Grid Helper Component

    In this tip, I demonstrate how you can add a T4 scaffolding template within the “Add View” dialog of the ASP.NET MVC Framework. I am creating a List scaffolding template for MVCContrib Grid helper component. Earlier, I have blogged about how to use MVCContrib Grid helper component but recently the component has changed a lot and introducing a fluent interface  that provides a cleaner and more discoverable API. You can read all details from Jeremy Skinner's blog about the new enhancements of MVCContrib Grid helper component. I am creating the T4 template against the latest trunk of MVCContrib Grid helper.