subsonic / SubSonic-3.0

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

Added Column Name Override Attribute & Tests #255

Closed nathanb closed 13 years ago

nathanb commented 13 years ago

Hey Guys,

I have a project where I'm working with an older database and they used some un-code-friendly column names. I created a new attribute for ColumnNameOverride("actual name") and tweaked some of the system a little bit to use it. I enabled the use of the DatabaseColumn.PropertyName property to store the original property name (was previously, seemingly unused). I changed the DataTable.GetColumnByPropertyName(string) to use this column field instead of the Name since Name now was overridden by the attribute.

I added four generic tests to check: inserting data to the field, selecting the field, selecting with a field constraint, and updating the field. All 42 simple repo tests pass for Sql Server. I have not tested the T4 scripts. Please advise if I need to retro-fit those. I'll be happy to.

-Nathan

nathanb commented 13 years ago

Ready for retest on active record and linq. (I added a supporting pull request in the templates project that resolves the active record issue).