Dofactory.com
Dofactory.com
 Back to list
Views:   7.3K
Replies:  1
Archived

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? 
Matt Masteller, Sep 23, 2013
Reply 1
Hello Matt: 

Yes, you can do that. In both T4 files you will find the following line: 
var sql = @"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
             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
Jack Poorte, Sep 23, 2013
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.