t4

Code generating SOAP Web Service Proxy objects yourself - C#/.NET 3.5/T4

Is there a framework or code already available that will give me more control over the code that gets generated based off my web references? I'm working at a new company. And the Web Services Proxies are all self contained in their own assembly. I would really rather generate this whole project. Every time they change something on the S...

Generate EF4 POCO classes first time only

The problem I'm having is, using the POCO templates, generating my POCO classes the first time only and not overwriting them when the templates are re-ran. I know this sounds hokey and the reason is that I'm actually changing these templates and trying to generate metadata classes rather than the actual POCO classes, but these metadata c...

Changing the generated code for "Add View"

I would like for the generate "List" view contents to have a check added to it to first check that the model has elements, it occurs to me that I have no idea how these views are generated. Can those be changed? ...

T4 Toolbox - mixing class feature and statement blocks

I'm a T4 newbie trying to use T4 Toolbox to generate F# code based on this answer, but it seems that class feature blocks can't be mixed with statement blocks. Here's my code: <#@ template language="C#" hostspecific="True" debug="True" #> <#@ output extension="txt" #> <#@ include file="T4Toolbox.tt" #> <# FSharpTemplate template = n...

Entity Framework Custom T4 Template

Hello, I am using the Entity Framework 4.0 and I am trying to extend my POCO classes generated by the standart T4 template with some custom properties. The classes which are generated by default from EF (without T4) contain 2 properties for every navigation property - NavigationPropertyId and navigationPropertyReference. What I am tryi...

SubSonic 3.0 - Save method with all columns as parameters?

Hi, Just getting started with SubSonic. I'm using the Repository pattern, so my domain objects are totally seperate, and SubSonic-generated classes are used only in my data access layer. I'm wondering if a template exists that will give me a Save method (Insert/Update) that requires all table column values as parameters. My thinking is ...

Get Generated Code's File Path in Visual Studio?

When using code generation templates in visual studio, is it possible to get the current location of the .tt file when the 'custom tool' runs? Suppose my custom template lives in c:\projects\something\template.tt When it does its magic, is there a way to return the path above? <#=PathOfCurrentTTFile #> (so that PathOfCurrentTTFile =...

Issue with T4 Templates for ASP.NET

I'm trying to get T4 to work with ASP.NET, however when I create a textfile and rename it to .tt, I don't get the option to run it Any ideas? ...

How to execute LINQ TO SQL within a T4 Template?

Is it possible to execute a SQL (TSQL or Linq To SQL) from within a T4 Template so that the schema information from a table can be used to customized the code generation? Thanks ...

Using Subsonic 3.0 Advanced Templates

Hi all, I've been trying to use Subsonic Advanced Templates in a project for a while but most of the time I find myself writing a Stored Procedure as I can't find a proper way of doing it in code. Subsonic created corresponding objects for my DB tables and for foreign keys it created IQueryable fields inside each object. These fields a...

Entity Framework 4.0 Autogenerated Classes not marked as Serializable

Hi, One strange thing i've got to see in Entity Framework 4.0 V2 Auto Generated Classes(tt) is that the classes are not marked as Serializable. Although they are having DataContract attribute for WCF. Now the problem is, when I store the POCO object into viewstate it throws me an exception saying that the class is not serializable. If...

Generating code for service proxies

I'm trying to generate some additional code base on the auto-generated webservice proxies in my VS2010 solution, I'm using a T4 template to do so. The problem is, automatically generated proxies are added in "Service Reference" folder but ProjectItems (files) are hidden by default and the following code does not find them in the project...

T4 trouble compiling transformation

I can't figure this one out. Why doesn't T4 locate the IEnumerable type? I'm using Visual Studio 2010. And I just hope someone knows why? <#@ template debug="true" hostspecific="false" language="C#" #> <#@ assembly name="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #> <#@ import namespace="System" #> ...

NHibernate mapping an Dictionary to sql database

I've got the a class created in code an added it to my class diagram. The class diagram is used by a text template generatorto generate code from this class diagram. I'm trying to map a dictionary to an sql database with NHibernate, the generated mapping looks ok to me, but the class property as shown below is giving me problems. This i...

Does Vim or SciTE has syntax highlight support for T4 template .tt files?

As title. Thanks ...

Adding a custom property to my EF4 Model

Let's say I have two tables in SQL that I want to have an EDMX model generated from (for now, going with automagical generation for everything) using POCO T4 templates. Let's say our two tables are Person (ID, FName, LName) and Comment (ID, PersonID, CommentText, CommentDate) with a one-to-many relation between the two (i.e. you can make...

Can I use T4 template features to generate C# classes from javascript class definitions?

I have a javascript based library and would like to generate some C# classes for it. Unfortunately, I do not know T4 at all, so I may not have included information you need to answer this question. please comment, and I will edit as needed. Thanks! ...

How can I check to see if poco entity framework object has been materialized?

I am using EF4 poco objects and I have changed my t4 template to add a partial method for every property. The partial method is called in the setter. When the objects are materalized the code in the setter gets ran and therefore my code gets ran. I do not want my code to get ran with the objects are being materialized. The way to do ...

Can someone rid me of these turbulent T4 template editors?

I'm using Tangible's editor and (no offense guys) it sucks. Its one painful step above notepad. But its (afaik) the only game in town. Does anybody have any tips/tricks on creating T4 templates in a non-painful way? For instance, I'm thinking about creating a T4 Template that essentially turns a class defined in a solution into a t...

How to open a file on relative path using T4?

I'm trying to run a T4 template that opens a XML file and uses it contents to generate a code artifact. However, I'm getting the an error message when I try to run a T4 template similar to the one below <#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Xml.dll" #> <#@ assembly name="System.Xml.Li...