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, Just checking something. Is this correct: When LightSpeed runs a query, it always returns exactly one object for each row in the SQL result set. This is true EVEN IF: (i) one of the SQL result rows corresponds to an entity which has been marked for deletion (with UnitOfWork.Remove) but not yet actually deleted (with UnitOfWork.SaveChanges). I.e. the result set from a query can include pending deletes. OR (ii) one of the SQL result rows corresponds to an entity which now, in memory, no longer matches the query criteria. E.g. I have changed Surname from Smith to Jones, but have not yet done SaveChanges. So when I query for Smiths, I get back the entity with the unsaved update to Jones. I.e. the result set from a query can include entities with unsaved changes, which, if they were saved, would exclude the entity from the result set. Is all of the above correct? (I'm actually hoping it is correct, because if so it means that LightSpeed works the same as other ORMs I'm used to.) John |
|
|
Yes both of those statements are correct. LightSpeed will still execute a database query for a requested query and then if possible load the entities from the identity map otherwise map them from the result set. This means that entities that have already been seen or worked on will be included in the set in the current state they are in from within the UnitOfWork rather than whatever the current database state may be. The only exception to this is if you are using FindAll caching and your query happens to be FindAll in which case you will get the cached set rather than us running another database query.
|
|
|
Thanks. John |
|