| 5/1/2007 11:06:15 PM |
I've been testing the ORMapper with a set of SQL 2005 tables. Everything seemed to work, but the resulting classes lacked the "s" at the end of my table names. Thus, the Attributes table became the Attribute class. This caused problems in the .NET code, because the Attribute property now has the same name as its containing class. What is the rationale for removing the plural?
The workaround, of course, is to rename all my tables and run the mapper again, but if there is a simpler suggestion I'd appreciate it. |
| 5/1/2007 11:10:52 PM |
First, lets be clear, that's not the ORMapper doing that -- its code generator you are using, probably either my ORHelper or the CodeSmith templates some have donated. I seem to recall there being an option to turn that off in the CS templates, but even if I'm wrong that's not hard to change in the templates yourself, and the ORHelper gives you the ability to edit things before generating code, although kludgy. Anyhow, even if not you just go with the default in code gen, you can modify it afterwards -- the ORMapper will use what you specify. As for why this is the default -- because its simply standard database practice to name tables with plural form while its standard OO practice to name objects with singular form.
Thanks, Paul Wilson |