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
|
I'm using LightSpeed v3.0.1005.12888 built on 1/23/2010 along with npgsql v2.0.5.0 (distributed with LightSpeed) to access a PostgreSQL v.84 database. I've created a table that uses a guid (uuid in PostgreSQL) as the primary key. I'm getting an exception when saving changes after adding a new row. I get the error "ERROR: 42601: syntax error at or near \"<\"" when the SaveChanges() is executed. Within the exception I see that the following SQL is being executed: SELECT DocumentStatus.GlobalId AS "DocumentStatus.GlobalId", DocumentStatus.<Guid>k__BackingField AS "DocumentStatus.<Guid>k__BackingField", DocumentStatus.ClientId AS "DocumentStatus.ClientId" FROM DocumentStatus WHERE DocumentStatus.GlobalId = ((E'a55954b3-f858-4f83-82a9-100000000230'))
I assume the error is on the line: DocumentStatus.<Guid>k__BackingField AS "DocumentStatus.<Guid>k__BackingField", I have the following questions:
Thanks in advance for your assistance... Alan
|
|
|
1. LightSpeed is the cause of the generated SQL. 2. k_BackingField means that you are using C# automatic properties. You can't use these with LightSpeed because, rather than mapping properties to database columns, maps *fields* to database columns. (This allows you do decouple your public, object-oriented API from your database schema.) When you use automatic properties, the C# compiler generates hidden backing fields with garbage names; but LightSpeed doesn't know that these are bad names and tries to load them anyway. So for LightSpeed entity classes you must always use "manual" properties. In addition, if the field is meant to be persistent, the setter must call the Entity.Set method, rather than just setting the backing field directly (this is so that LightSpeed knows that the entity needs saving). (If the field isn't meant to be persistent, it has to be marked with the [TransientAttribute].) 3. We periodically update the library versions shipped with LightSpeed. It looks like the PostgreSQL one could do with an update and we'll try to get that done in the near future. If 2.0.8.0 includes features or bug fixes that you need, let us know and we'll bump the priority; or you can use a binding redirect to make LightSpeed load 2.0.8.0 instead of 2.0.5.0. Thanks for drawing our attention to this! |
|
|
Thanks for your response Ivan, it was quick and informative! |
|
|
re: item 3 -- Any ETA on the update to a more recent version of npgsql?
Thanks.. Alan |
|
|
Thanks for the reminder. Beginning with tonight's nightly (3 Mar 2010, available from about 1500 GMT) we are upgrading to Npgsql 2.0.8. Please let us know if you see any issues or regressions. |
|
|
Thanks Ivan, that is great news. --Alan
|
|