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've noticed that since upgrading from LS1 to LS3, when using the GUID identity method, that new entities have an initial ID value of Guid.Empty (under LS1 their ID was a unique GUID as soon as they were created) - the new entities only receive a unique GUID once they are attached to a UnitOfWork. Unfortunately, my application was relying on entities being able to be uniquely addressed before being associated with a UOW. Is there any easy way to overcome this breaking change? For example, can I override Initialize() in my entities and explicitly set ID = Guid.NewGuid()... Thanks, Greg |
|
|
No, this isn't possible. LightSpeed doesn't let you set the Id directly, and from 2.0 onwards it only sets the Id when you add the entity to a unit of work. This is because some identity methods require access to the database, which in 1.x was okay because the database context was global, but in 2.0 required a LightSpeedContext which was obtained via the IUnitOfWork. If you're moving from 1.0 to 3.0 then you must be making some significant changes to the way you manage entities and units of work anyway; can you not change the ordering of operations so that entities are added to the UOW before you need their Id? |
|