C
Chris Dunaway
I used CodeSmith with a template to convert a Sql table to a class, i.
e., it took the column names from the table and create a concrete class
from it. It works fine, but one problem is caused by the fact that the
column names in the table are all UPPERCASE. So a resulting property
might be:
public string ORDERNUMBER
{
get { return _ordernumber; }
set { _ordernumber = value; }
}
and what I would LIKE it to be is:
public string OrderNumber //Note proper case
here
{
get { return _ordernumber; }
set { _ordernumber = value; }
}
I would like to find an algorithm that will convert the name correctly.
Does anyone know of such an algorithm?
I am presuming that since it must pick out the individual words Order
and Number that it must use some sort of dictionary of words. Perhaps
with a setting to indicate the minimum word size such as 5 letters.
It would not produce perfect output, but I think it could be fine tuned
to catch most words. The remaining ones would have to be edited by
hand. Of if there were multiple optons, pop up a dialog to give the
user a choice.
Anyone know of any code that can accomplish this?
Thanks
e., it took the column names from the table and create a concrete class
from it. It works fine, but one problem is caused by the fact that the
column names in the table are all UPPERCASE. So a resulting property
might be:
public string ORDERNUMBER
{
get { return _ordernumber; }
set { _ordernumber = value; }
}
and what I would LIKE it to be is:
public string OrderNumber //Note proper case
here
{
get { return _ordernumber; }
set { _ordernumber = value; }
}
I would like to find an algorithm that will convert the name correctly.
Does anyone know of such an algorithm?
I am presuming that since it must pick out the individual words Order
and Number that it must use some sort of dictionary of words. Perhaps
with a setting to indicate the minimum word size such as 5 letters.
It would not produce perfect output, but I think it could be fine tuned
to catch most words. The remaining ones would have to be edited by
hand. Of if there were multiple optons, pop up a dialog to give the
user a choice.
Anyone know of any code that can accomplish this?
Thanks