Reputation: 668
I need to overwrite the Model.tt file, to add some special code to be generated to the constructor of a specific entity type.
I have two questions:
Upvotes: 0
Views: 202
Reputation: 668
I got it!
Just putting these lines of code inside the constructor section at the tt file public <#=code.Escape(entity)#>()
<#
if(entity.Name == "Order")
{
#>
this.Initialize();
<#
}
#>
Upvotes: 0
Reputation: 368
You can try having another partial class as your generated entity class. Write your custom logic in this partial class. e.g.
Your entity class is Customer.cs Create another Customer.cs partial class in same namespace but separate folder(maybe) and add your logic there. You should be able to use it.
Upvotes: 1