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
|
Maybe I don't understand the patterns I should be following in a Winforms app, but I seem to keep bumping up against issues with long running units of work. I really need a way to reset the identity map for a single entity so I can reload the database version within a single long running unit of work, rather than keep getting back the same one. Any chance of something like: unitOfWork.Refresh(thisEntity) or unitOfWork.Detach(thisEntity) ? |
|
|
This is a frequently requested feature and is on the radar, but there are some design issues mainly around associations which we need to resolve. However our recommendation is to try to avoid really long-running units of work (even once we add this feature). For example, consider an app with a "browse" screen that lists all purchase orders, and an "edit" screen that allows the user to edit an order. Rather than trying to do all this within one UOW, you might create a UOW to load the "browse" screen (and then discard that UOW). When the user clicks on Edit, you would then create a new UOW just for that one edit screen, load the edited entity into the UOW via its ID, and dispose the UOW once the edit is saved or cancelled. This would allow you to refresh the browse screen or individual entities by reloading the data in a new UOW (which, again, you would discard once the entities were loaded). Obviously your app design may not be as conveniently packaged as this, but if you could say a bit more about your app structure then we might be able to suggest a strategy that would avoid the need for long-running units of work. |
|