views:

507

answers:

3

In the database I have about 150 tables - most of them from previous versions of the application I currently work on. For my app I only need about 20 tables - is there a way to ignore some of the tables by setting some parameter in web.config?

A: 

Yes, you can use excludeTableList: see here

cbp
Thanks, but it's now ignoring my views, please see my config section below.
+4  A: 

suppose you have tables with names Table1, Table2, Table3 and you want to use only Table1 and Table3

You can use excludeTableList or includeTableList attributes to control this.

includeTableList

<add name="YourProvider" type="SubSonic.SqlDataProvider, SubSonic" 
 connectionStringName="YourConnection" 
 generatedNamespace="YourNamespace" includeTableList="Table1, Table3"/>

excludeTableList

<add name="YourProvider" type="SubSonic.SqlDataProvider, SubSonic" 
 connectionStringName="YourConnection" 
 generatedNamespace="YourNamespace" excludeTableList="Table2"/>

Usually if you have few table to include you will use includeTableList so you have to type fewer names. You can also use * wildcard like this includeTableList="Table*" />

viewStartsWith

if your view starts with vw_ you can add following option:

viewStartsWith="vw_"
TheVillageIdiot
Thanks, but it's now ignoring my views, please see my config section below.
A: 

Thanks, that works, but I have problems with all views being excluded now. I'm trying to include only tables that start with "UCC09_tbl" and views that start with "UCC09_vw".
Also I want to rename them as in example:
UCC09_tblTest -> Test
UCC09_vwTest -> VwTest

Here's my config:

<add name="MyProvider" type="SubSonic.SqlDataProvider, SubSonic" 
connectionStringName="MyConnection" generatedNamespace="MyNamespace"
regexMatchExpression="^(UCC09_tbl|UCC09_vw)" regexReplaceExpression=""
includeTableList="UCC09_tbl*, UCC09_vw*" />
please try using viewStartsWith attribute
TheVillageIdiot