Home  /  Questions  /  Question

50   50
Oct 13, 2013

How to verify that DomainGenerator.tt is actually doing anything.

I've tried unsuccessfully to get the DomainGenerator.tt file to produce some project files by trying to follow the instructions included with the std and then pro edition of the 4.5 framework products. To verify that I was triggering the generator properly I loaded the pro version of the Art app. Found the Art.Domain->_Spark->Domain.cs file and added "Ben was here! to the first comment in the file. I set the appropriate connection string for my project location. Then I right clicked on Art.Domain->_Spark->Generator->DomainGenerator.tt and selected "Run Custom Tool" from the context menu. I didn't receive any errors or warnings and the comment "Ben was here!" is still in the generated file. I expected to get a message after selecting the "Run Custom Tool" menu option telling me that the content of the Domain.cs file had changed and asking me if I would like to load the new content.

Does my test sound valid? What might be causing the failure to generate issue? How should I go about trouble shooting it? And more importantly, how do I go about getting it to work?

Thanks for your help.

Ben "was here!"

508   99.9
Oct 13, 2013

The fact that you don't get any errors is a good sign. It means your connection string is valid and the Code Generator ran without errors. 
Remember that the Code Generator does not overwrite existing files: this is to protect developers from losing valuable code, 

To see the Code Generator in action, you could delete for example the Core.cs file. Then run the Code Generator.
The file will be re-generated.  To see the newly created file remember to toggle the 'Show all Files' icon at the top of the Solution Explorer.
Then right click on the new Core.cs file and select 'Include in Project'. 

Once the generated file is added back into your project, compile and the project is complete again. 
Hope this helps. 

PS:  I suggested Core.cs because it does not depend much on the database, whereas Domain.cs is entirely database driven which, in turn, requires that all tables in your database are according to the Spark standards.  So, try Core.cs first and then next Domain.cs.