t4

Help with T4 and Schema Information

Hello, I am trying to create a data access layer using t4 and C#. I would like to be able to provide a DAL where I can access any database. The problem I am having is with some of the schema information. I am able to retrieve some information like column and table names but I would also like other information like the name of the primar...

T4 vs CodeDom vs Oslo

In an application scaffolding project on which I'm working, I'm trying to decide whether to use Oslo, T4 or CodeDom for generating code. Our goals are to keep dependencies to a minimum and drive code generation for a domain driven design from user stories. The first step will be to create the tests from the user stories, but we want the ...

How to use T4 code generation templates with VS C++ projects?

T4 template files are automatically recognizable by the IDE under C# projects, but I have no clue on how they can be integrated into C++ projects (other than using make files). Any ideas? ...

Subsonic 3 alpha and Visual Web Developer 2008: problem with t4 templates

I use VWD 2008 Express on Windows 7 beta. When I add Subsonic 3 templates to my MVC RC project, Web Developer Express doesn't generate classes based on them. Connection string is correct. Do you have any ideas? ...

What are the Differences between XSLT and the T4 Code Generation Methods?

I am just getting into the idea of code generation for repetitive coding tasks and have seen both of these approaches. I've seen the XSLT approach in an Apress book Code Generation in Microsoft .Net and have read about the T4 approach in relation to what's new in the MVC framework. What kind of projects is each method better suited for?...

T4 template for NHibernate? - not Fuent NHibernate

Wondering if anyone knows of a set of T4 templates for generating C# POCO classes and also mapping XML files for NHibernate from a set of tables in a database. I saw that David Hayden has created T4 for generating FluentNH code based upon a DBML model, but I'm not quite ready to use FluentNH yet as there isn't even an official release ye...

Code Generators or T4 Templates, are they really evil?

I have heard people state that Code Generators and T4 templates should not be used. The logic behind that is that if you are generating code with a generator then there is a better more efficient way to build the code through generics and templating. While I slightly agree with this statement above, I have not really found effective wa...

Adding properties to T4 template - picking server, database, table

Folks, I'd like to create some T4 templates for generating class files (about 7 per table) from a database to support our in-house ORM (don't ask - long story and historical reasons.....) What I'd really love to do is have a property on my main TT template to visually pick server, database and table for which to create the files (somet...

Javascript Result to generate Jquery CRUD ajax operations

Latest Asp.Net MVC RC permits to return JavaScript ActionResult. I'd like to dynamically generate from the controller the Jquery script code associated to perform the classical $.ajax calls to the controller for Create Read Update Delete operations in ajax instead of classical get/post form actions. Should I generate the javascript code ...

Cannot find Microsoft.VisualStudio.TextTemplating assembly

I am doing some work with T4 (Text Template Transformation Toolkit) and am trying to get to a point where I can create my own custom text template host. However, all of that relies on the Microsoft.VisualStudio.TextTemplating assembly and I cannot find it on my system! I first tried adding a reference to the assembly in Visual Studio, b...

SQL SMO not enumerating tables

I feel like a dork just for asking this, but I'm not getting any help from Google, and I paged through all of SO's results on a simple search for SMO and didn't see it either. The short version is that I'm starting to play around with T4. I'm expanding on Oleg Sych's initial tutorial to provide enumeration over all tables to create a (I...

Is there any T4 Editor for Visual Studio 2010 CTP2?

Hi there, i am looking for a T4 Editor for VS 2010 CTP2. Clarius states on their Blog they are waiting for the Beta1. Any idea other idea where to look? Thanks Tim ...

Can you add custom T4 Templates to the VS2008 "Add New Item" dialog?

I have created a set of templates that I want to share across multiple projects. Is it possible to add the template to the Project “Add New Item” dialog such that when I choose it an instance of the code file is generated from the template and added to the project? Update Thanks for suggestions Preet. That answers the question but I th...

"Entry Point Not Found" error when using the Text Templating Engine in the VS 2008 SDK

I am using the Microsoft.VisualStudio.TextTemplating.Engine class from the VS 2008 SDK along with the objects from the Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates namespace to automate the process of creating C# classes from T4 templates. Here my code. It taken straight from the example on Oleg Sych's Blog... usi...

Best way to store configuration settings for T4

I need to create some files using Visual Studio T4 (templating). What is the best way to import some configuration settings into multiple .tt files and have it accessible in the templating code portion. ...

Abusing type overloading to create boilerplate code in C#

Hi all, In a project I'm currently working on, we've added a wrapper class for accessing the HttpSessionState object. The trouble is that the current solution means you have to write some code to wrap the functionality. I came up with the following solution /// <typeparam name="TKey">Class used for generating key into session state sto...

SubSonic ASP.NET MVC sample in Visual Web Developer Express

In Visual Web Developer Express 2008 the SubSonic ASP.NET MVC template doesn't seem to work with a new database I added. I removed the Chinook Database and created my own one. I understand the the .tt files in the Models folder are used to generate code, but they don't (despite changing the ConnectionStringName to what I set in the web.c...

Can T4 templates use the same library

I have a library that defines a class namespace ClassLibrary1 { public class Class1 { public static readonly int Rate = 5; } } In the same lib I add a tt file <#@ template debug="false" hostspecific="false" language="C#" #> <#@ output extension=".cs" #> <#@ import namespace="ClassLibrary1" #> <#@ assembly name="C...

T4 Templates and Visual Studio Item Templates

Is it possible to create a Visual Studio item template that generates from a T4 template? My google-fu does not seem powerful enough to yield an answer! ...

T4 Confusion

I think I understand the basic principals of T4 but I'm having a hard time figuring out how to apply it to my particular situation. I have an application that display lists of objects of some kind - doesn't matter what. I want to allow the users to select 1 or more of these objects and submit them to any template. The template could g...