Subsonic 3.0 uses T4 templates, which makes is very easy to extend. One thing that is missing out of the box though, is the ability to specify only tables to be included. The current download (version 3.0.0.3) has an array (ExcludeTables) for specifying table names that we don’t want to generate a DAL for, but if we want to generate only a few tables on a database that has 10s or even hundreds of tables, this is not very efficient. It’s great that the T4 templates are very easy to extend.
Steps:
1. Create a new array to hold table names to be included. Put this in Settings.ttinclude.
//this is a list of tables we explicitly want to include, if no records or null, then it is not used
//string[] IncludeTables = null;
string[] IncludeTables = new string []
{
“Customers”
};
2. Look for any occurrence of ExcludeTables on the rest of the T4 files because we pretty much know the if statements dealing with this filters the list of tables to generate a DAL for.
Example
Change:
if(!ExcludeTables.Contains(tbl.Name))
to:
if(!ExcludeTables.Contains(tbl.Name) && ((IncludeTables == null || IncludeTables.Count() == 0) || IncludeTables.Contains(tbl.Name)))
That’s pretty much it.
Here is a zip file containing a working version.
SubSonic_3_0_0_3_MTY (zip file)
Trackback
by ARTHUR
26 Jun 2010 at 15:31
PillSpot.org. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Pillspot.org. Herbal-supplements@buy.online” rel=”nofollow”>.…
Categories: Anti-allergic/Asthma.Vitamins/Herbal Supplements.Womens Health.Mental HealthSkin Care.Anxiety/Sleep Aid.Antidiabetic.Antibiotics.Pain Relief.Mens Health.Stomach.Blood Pressure/Heart.Antidepressants.Stop SmokingEye Care.Weight Loss.Anti…
Trackback
by NICK
04 Jul 2010 at 08:17
Buy:Female Pink Viagra.Advair.Wellbutrin SR.Lipitor.Buspar.Cozaar.Zocor.Lipothin.Amoxicillin.Female Cialis.Ventolin.Acomplia.Seroquel.Nymphomax.Aricept.Benicar.Lasix.Prozac.Zetia.SleepWell….
Trackback
by CLYDE
21 Jul 2010 at 21:19
Buy:Buspar.Female Pink Viagra.Ventolin.Prozac.Female Cialis.Cozaar.SleepWell.Acomplia.Aricept.Seroquel.Lipothin.Nymphomax.Amoxicillin.Zetia.Lipitor.Benicar.Advair.Lasix.Wellbutrin SR.Zocor….
Trackback
by way
30 Aug 2010 at 03:18
Two http://pbedhx3h-k.04FORDPARTS.US/tag/banff+way+Two/ : banff…
Two…