Question

I changed the .tt (template) file contained by a .edmx file to change the generation of the objects in my edmx diagram.

In my specific case I just wanted to add [Serializable] in my template to have it in every of my objects generated.

I did add this line of code:

<# Write("[Serializable]"); #>

here, as it seems to be, the right place:

<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
Write("[Serializable]");
#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>


For me it seems to be the right stuff, at the right place. Nothing too fancy here. But when I hit the "Run custom tool" option on my .tt file to re-generate the code, it simply does nothing.

How do I make it generate the code I need?

Thanks in advance.

Was it helpful?

Solution

Well, Crawling the web for an answer, finding it myself and assuming I did not find the stuff on the internet, I'll put it here instead of deleting the question. Please be aware it is really stupid.

I did not have a high comprehension of the language used. Because of this I wrongly assumed

<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>

was the correct place to put my code generation over. It was not. The correct place is actualy:

<#=codeStringGenerator.EntityClassOpening(entity)#> : DataObject


Maybe this post will help someone having the same problem, just needind to be told to search somewhere else.

Have fun.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top