Since we are working in a distributed environment with many users and many tables to be queried (about 200) we decided to use the following software solution:
- For read operations use DataContext as a singleton.
- For write operations use n different DataContext per business object.
In this way we are experiencing the following problems:
- write operations occur properly, but when I try to read results are not updated to my last submit change.
We have tried to set ObjectTrackingEnabled to false or groped to clear cache on the DataContext but this has not yielded the expected results.
Can you give us support?
How do you recommend to use the n DataContext to write and the only DataContext to read?
How can I clear the cache data?
P.s. My previous step was to use DataContext embraced in using statement per business object but there is memory leak problem as reported http://www.devart.com/forums/viewtopic.php?t=22490[/b]
DataContext & Performance
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Whether object tracking is enabled or not, DataContext caches the retrieved entities to make access to them faster. There is no public interface for clearing the entity cache.
To get the actual state of an object (or an object collection) from the database, you can call the Refresh method with the OverwriteCurrentValues mode.
Generally, if the cached data often becomes stale during the application lifetime, it is recommended to use short-living DataContext instances for reading as well.
To get the actual state of an object (or an object collection) from the database, you can call the Refresh method with the OverwriteCurrentValues mode.
Generally, if the cached data often becomes stale during the application lifetime, it is recommended to use short-living DataContext instances for reading as well.