yasser777 / nettiers

Automatically exported from code.google.com/p/nettiers
0 stars 0 forks source link

Enum can not lead off with numeric values. Causes Nettiers to not compile is fields are not unique after numeric values are stripped out #406

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Try to enum a table in nettiers where the unique fields are unique in the 
database but not unique when numeric values are the start to the field ie:

My table has a lot of entries like:

35 Judicial District

37 Judicial District

100 Judicial District.

The problem is that the number gets stripped out and I'm left with duplicate 
enum names. Judicial District gets repeated in the code since numeric values 
can not be in the name

What version of .netTiers and CodeSmith are you using?

2.3.0

Please provide any additional information below.

Forum Post:
http://community.codesmithtools.com/nettiers/f/16/p/12085/46753.aspx#46753

To work around this I added an underscore in to start of the enum name.

I modified the regular expression that detects the numeric values at the start 
of the name 

We put an underscore of any numeric values _

 //Remove digit characters from start

           //val = Regex.Replace(val,@"^[0-9]+","");

           if (Regex.IsMatch(val,@"^[0-9]"))

               val = "_" + val;

The above modification was made in the following template file:

<%--
 * $Id: Enum.cst,v 1.2 2005/12/03 12:34:49 jroland Exp $
 * Last modified by $Author: jroland $
 * Last modified at $Date: 2006-03-16 16:53:08 -0600 (Thu, 16 Mar 2006) $
 * $Revision: 62 $
--%> 

Original issue reported on code.google.com by a...@pehas.com on 1 Dec 2011 at 10:42