subsonic / SubSonic-3.0

SubSonic 3.0 for the .NET 3.5 Framework
http://subsonic.github.io/
557 stars 209 forks source link

FooX issue when tablename == columnname #277

Open ghost opened 12 years ago

ghost commented 12 years ago

Fixes an issue where, when the tablename and columnname were the same, subsonic would not read from or update the database column.

The generator correctly recognizes the column and, in the case that it shares a name with the table, appends an "X" (e.g., CREATE TABLE foo ( foo varchar );

would create an object for table foo, containing a member, fooX. However, reading from fooX would not match what was actually in the datastore, and setting fooX and saving would throw an exception.

Closes #276

ajtatum commented 12 years ago

I'm not sure if my issue is exactly this or if this isn't working properly, but I have a table named Products and a column named Product. After generating the code, SubSonic still insists on the column being ProductX... which is fine if it actually mapped properly and didn't case the code to error out.