Home  /  Questions  /  Question

50   50
Sep 23, 2013

PRO Spark Domain/Rest Generator C# 4.5 for large database schemas

I have a legacy dbase with hundreds of tables. I only need a handful of them for a current web/api project. Is it possible to select only a subset of the tables to be used by the code generators? 

508   99.9
Sep 23, 2013
Hello Matt: 

Yes, you can do that. In both T4 files you will find the following line: 
             WHERE TABLE_NAME NOT LIKE 'aspnet_%'  AND TABLE_NAME NOT LIKE 'webpages_%'
               AND TABLE_TYPE = 'BASE TABLE'
            ORDER BY TABLE_NAME";
This is where you can include a clause like: AND TABLE_NAME IN (..your list of tables..).


Since you are dealing with a legacy database, I would like to mention that the tables should adhere to the Spark data model conventions (in particular the integer Id, the audit fields are optional), otherwise it will not work.  

Hope this helps. 
Jack Poorte