tags:

views:

68

answers:

1

I'm trying to generate DTO's with T4. I found a great blog post that does exactly what i'm looking for but it explodes on Nullable data types.

http://weblogs.asp.net/cibrax/archive/2009/03/11/code-generation-with-t4-an-entities-to-dto-example.aspx?CommentPosted=true#commentmessage

This generates code with Nullable types like below

   [DataMember(Name="terminationCFDate")]
    public System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] TerminationCFDate
    {
        get; set;
    }

I am looking for something like below

    [DataMember(Name="terminationCFDate")]
    public Nullable<DateTime> TerminationCFDate 
    { 
       get; set; 
    }

I am very new to T4. Any suggestions?

A: 

Modified the template. It was using reflections.

William