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
|
Hi, I have a table with a primary key named "Identifier" of type GUID. In the Lightspeed entity properties, I set "Identity Column Name" to "Identifier", and I use a custom INamingStrategy class that overrides GetIdColumnName() to return "Identifier". Everything works great, except when I set "Order By" in the entity properties to "Identifier", in which case queries fail with "Query error: Count not find field [Identifier] on model [MyTable]". I found that the same holds true when I set "Order By" to one of the automatically-tracked create and update fields (I call mine "Created" and "Updated", again with custom naming strategy). Assigning "Order By" to other columns in the table works fine. Shouldn't the "Order By" expression be in terms of the names of the columns as they appear in my database? Thanks in advance for your help. Derek |
|
|
Answered my own question. Sorry, I should have tried the easy alternative before posting, namely to use "Id" (or "CreatedOn" or "UpdatedOn") as the "Order By" expression. That of course works. So it would appear that the "Order By" expression is not used in the SQL statement, but in sorting the resulting entities? |
|
|
Hi Derek, The OrderBy should be expressed in terms of the properties on your entity - so you will still want to order by Id or CreatedOn, LightSpeed will then translate these into the appropriate column names when emitting SQL as per your naming strategy.
Jeremy |
|