Windows 7 Phone Database Rapid Repository Exclude Entities From Cache
Download the code and a fully working example application from http://rapidrepository.codeplex.com/
Tutorials
- Introduction
- Set up the Rapid Repository
- Create, Read, Update and Delete
- Eager Loading
- Examining Pending Changes
- Exclude entities from the cache
If you are writing a memory intensive windows 7 phone application and can’t afford any extra overhead, you can turn off the default caching within Rapid Repository on an Entity basis.
The best place to do this is at the start of your application - then all you need to do is add similar to the following code for each entity type you want to exclude:
- public MyApplicationStartup()
- {
- EntityCache.NoCache<Customer>();
- }
As you can see, in this example, a Customer entity is excluded from the cache.
Note: This does mean that each time you load an entity where the type is excluded from the cache, it will have the overhead of reading from the file system and deserialising,
Hope this is useful.
Sean McAlinden