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

  1. Introduction
  2. Set up the Rapid Repository
  3. Create, Read, Update and Delete
  4. Eager Loading
  5. Examining Pending Changes
  6. 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:

Remove Cache Example
  1. public MyApplicationStartup()
  2. {
  3.     EntityCache.NoCache<Customer>();
  4. }

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

4 Comments

  • nice!
    but i have get some question about Rapid CacheEntity .
    turn off set about cache just take out cache entity type.

  • Hi Chenkai,
    Glad you like it.
    Every entity you save or get from the repository is cached by default, if for any reason you want the repository to get the file from the file system each time (maybe your app is really memory intensive) you can turn it off for each type, for example if you have a GameScore entity class, you can enforce that no gamescores are cached using EntityCache.NoCache().
    Hope that helps.
    Sean.

  • Hi Sean,

    Nice Work!!
    When will we see FullTextSearch implemented :)?

    Thanks, and keep it up

  • Hi Haytham,
    Glad you like it, I hadn't thought about doing a full text search but it sounds like a really good idea, I'll add it to the road map.
    The latest beta release has a View querying feature which I think is really cool - check out http://weblogs.asp.net/seanmcalinden/archive/2010/12/05/windows-7-phone-database-querying-with-views-and-filters.aspx
    Thanks

    Sean.

Comments have been disabled for this content.