I have many forms that incorporate grids like Infragistics WinGrid. To work well with these I need to keep a uow open all the time the form is open, otherwise we run into problems with deletes, and other issues.
However, sometimes we update some data in a seperate form or computer, and we need to reload the grid, unfortunately because of the caching we end up retrieving the same data. I know we can use the reset option on the SaveChanges method, but often the saves are made elsewhere, and not with this uow.
So I think it would be useful to have a simple method ClearCache(), which does as is says, clears all caches, and allows us to get the latest data directly from the database.
Status: New
|
Thanks for the request. Here's where I think this falls down:
So in my view this would not resolve the issue you're having. I'd recommend that this is more an issue around the mechanics of the UnitOfWork pattern. If you truly wish to reset the data to reflect the current database contents then you should dispose of your current unit of work, create a new one and then re-select your data. Disposing and creating a new unit of work would only be two lines of code. Re-fetching all your entities fresh would be context sensitive to your application and be the actual hard work in this scenario. I appreciate any feedback you have on this, but so far it doesn't sound like it would help in the scenario raised. |
|
|