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
|
Is it a LightSpeed convention (in the sense of convention over configuration) that entity properties have to have the same name as the private fields? For example, in the following, CustomerCode has a different name to _customerNum. Would this be legal? private string _customerNum;
|
|
|
It is legal, but there are a couple of things to watch out for: 1. If you are using optimistic concurrency tracking and partial saves, it may confuse the partial save subsystem (this is a bug in LightSpeed). 2. LightSpeed queries must be expressed in terms of the field names. When using the core query syntax, this can lead to confusion, as you must remember to write Entity.Attribute("CustomerNum") instead of Entity.Attribute("CustomerCode"). When using LINQ, you can't even do this because the compiler will only let you refer to CustomerCode. You can get around this by specifying QueryPropertyAttribute on the field (you can't do this in the designer, but the designer won't generate different field and property names anyway). So it is usually preferable to keep the private field and public property in sync, and instead to use the Column Name designer setting (ColumnAttribute in hand-coded entities) to map the private field to the required database column. |
|