This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Table MyFancyTableProperties is generated to class MyFancyTableProperty with this attribute |
|
|
Are you setting PluralizeTableNames on your LightSpeedContext? |
|
|
Nothing with/without PluralizeTableNames=true Perhaps a stupid question, but does it exists some documentation of what "PluralizeTableNames" means (what consequences has if it is false or true). |
|
|
Sorry for butting in (again) but I can answer what it with an added question on top of it... (although I can't remember if it is to be found in the documentation). I'm sure that Ivar or someone else will tell me if I am wrong... There is a quite accepted convention amongst to DBAs to to have database table names in pluralwhilst we code monkeys prefer class names to be singularis. Obviously you would prefer the O/R mapper to do this name convertion for you (convention over configuration) too. So basically with an example, having PluralizeTableNames=true will mean that your domain model class can be named Car and your table named Cars w/o you doing any configurations for it. Now to my added question: I have been told some year ago that Lightspeed also manages to convert names like Child / Children... Is that done by having a list of those nouns or are you actually having some type of grammatical rule at your disposal? If it is a list, I think you can publish this list at the docuemtation of the PluralizeTableNames. As a side track: We started from scratch with a new application using this O/R mapper. So we skipped the pluralizable naming convention in the database. It is a stupid convention anyways. Off course it is many in it, it is a table. PS: PluralizeTableNames is a bit trick to trasp the meaning of. I did not understand the use first either until having asked ni the forum. At first I think it sounded like something much more complicated to understand ....
|
|
|
What Tobias said *grin*. Pluralisation of table names is discussed in the User Guide under "Conventions" -- see the section headed "Classes and Tables." On re-reading however I accept that this could be more explicit. The pluralisation rules (by which we can match a Child class to a Children table and a Mouse class to a Mice table) are the same as in Andrew's Inflector.NET (http://andrewpeters.net/inflectornet/), itself a port of the Ruby on Rails Inflector class. This uses a mix of grammatical rules with the occasional special rule for a specific noun. We're a bit reluctant to publish the list of supported pluralisations because we occasionally need to update or tweak this list and we don't currently have a way to ensure the documentation stays in sync when this happens. We'd suggest referring to the Inflector.NET source code as a good guide. lsgen automatically singularises plural table names. So when in csa's original query it finds a table named "MyFancyTableProperties", it creates a class called "MyFancyTableProperty." But if you try to use that class in a LightSpeedContext where PluralizeTableNames is false (the default), that will result in LightSpeed issuing a query along the lines of SELECT ... FROM MyFancyTableProperty, which of course fails with the error csa reports. If you set LightSpeedContext.PluralizeTableNames to true, then LightSpeed pluralises the class name when building the SQL query, resulting in a query along the lines of SELECT ... FROM MyFancyTableProperties -- and that should now work. Hope that clarifies things -- if you still get the "Invalid object name" error after doing this, please let us know and could you post the SQL trace please? Thanks! |
|
|
:-) |
|