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 Guys, I am new to LightSpeed, but not to ORMs. I have been working on a project that recently upgraded from LS2 to LS3. In the code, we receive a list of entities, loop through the entities and attach them to the UOW. Finally we call SaveChanges() on the UOW. At this point, it seems the LS is trying to complete the operation, but nothing occurs. No exceptions are thrown. I have left it overnight and returned to the debugger still sitting on SaveChanges(). Example code: public void functionName(IList<Entity> entities) { using(UnitOfWork unitOfWork = context.CreateUnitOfWork()) { foreach(Entity entity in entities) { unitOfWork.Attach(entity); entity.ModifiedDate = DateTime.Now; } unitOfWork.SaveChanges();
I know we can access the DB because we perform a read to recived the list of entities. Is there something that changed between LS2 and LS3 that could possible explain this odd behaviour?
Cheers.
|
|
|
I can't think of anything that changed between LS2 and LS3 that would cause this. I would expect most connection issues to cause a timeout rather than a freeze. It is possible you have some sort of transaction deadlock (is the unit of work that read the entities still live at this time?), or perhaps a DTC issue, but again I can't think of anything that changed between v2 and v3 that would affect this (and again I would expect a timeout rather than a freeze). One thing you could try is waiting for it to enter SaveChanges and while it is stopped there break into the debugger (the "Pause" button on the Visual Studio debugging toolbar). This should dump you into a call stack where you can see where it's stuck. (You can resume and pause multiple times to check that it is always stuck in one place rather than going round a loop or something.) You can also use LightSpeed logging and/or your database profiling tool (e.g. SQL Profiler) to see if anything is being sent to the database and whether the database is responding; this might also help to diagnose if there is a lock holding up the UPDATEs. |
|