Handle Special characters in field names.

Any template questions or comments or suggestions

Handle Special characters in field names.

Postby mfreidge on Thu Dec 21, 2006 12:40 am

I've used EntitySpaces templates to generate code for my database and noticed that columns with special characters are not encoded and causes compile errors. For example database columns

[E-mail] [nvarchar](100))
[Account%] [numeric](28, 2) NULL CONSTRAINT
[Account$] [numeric](28, 2) NULL CONSTRAINT
Generated to invalid

Public Const E-mail As String
virtual public System.Decimal? Account%
virtual public System.Decimal? Account$
It will be good to have standard functions to encode special characters and include them in most templates.
It could be similar to XmlConvert.EncodeName Method, that uses _xHHHH_ escaping.
See my blog post http://geekswithblogs.net/mnf/articles/101737.aspx for an example of similar implementation.
Michael Freidgeim
Blog: http://geekswithblogs.net/mnf/
mfreidge
Corporal
 
Posts: 16
Joined: Tue Aug 01, 2006 3:21 am

Postby mike.griffin on Thu Dec 21, 2006 1:30 am

In EntitySpaces there is a special template in the esPlugIn area of the MyGeneration template browser, there is an textbox call trim characters, you should add % and $ there, however, I can tell you that using those characters is probably going to cause other issues.
User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN


Return to General Template Questions/Comments

Who is online

Users browsing this forum: No registered users and 0 guests

cron