开发者

T4 to generate DTO' and Nullable Datatypes

开发者 https://www.devze.com 2023-01-11 03:35 出处:网络
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.

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="term开发者_如何学JAVAinationCFDate")]
    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?


Modified the template. It was using reflections.

0

精彩评论

暂无评论...
验证码 换一张
取 消