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 have recently moved to SQL Azure and found the Azure closes connections. Since my program was designed for long open connections for a few users I have to rework the way I use the UnitOfWork. I have to handle the life of Entities manually rather than letting the UnitOfWork do it. (I dont think I am ready to write my own connection strategy, yet) that out of the way. An entity that has be created from a unit of work then the unit of work is disposed. when I want to delete that entity should I call Attach(Entity) First or should I just call Remove(Entity)? uow.Attach(Entity); uow.Remove(Entity) or just uow.Remove(Entity); |
|
|
I would do the Attach first. It's normally not necessary, because Remove does an Attach internally if required, but it could make a difference if the UOW already contained a copy of the entity being Removed (though in this case it would be better to Remove the copy that was already there anyway, rather than Attaching an older copy and then Removing that). If you're confident that the Remove is happening on a fresh UOW, though, you can skip the Attach. |
|