Windows 7 Phone Database Rapid Repository Introduction

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

    As my Windows 7 Phone database open source project called Rapid Repository is about to go beta, I though it best I post some tutorials and explain what it is and how it works.

     

    Overview

    As an overview, the Rapid Repository is a document database that sits on top of the Windows 7 Phone isolated storage.

    The beauty of using a document database rather than a traditional database is that you do not need to create schema’s, tables, stored procedures or any thing else associated with relational databases.

    All you need to do is create your entity class (such as a Customer class) and call Add on the repository.

     

    How it works

    When you add, update or delete using the repository, under the scenes it is actually creating, updating or deleting json files which are stored in isolated storage.

    The repository takes the entity class that you have passed to the Add or Update method and serialises them to json, this means that you can have complex objects with complex properties, lists, list of complexx objects etc – you can basically store your entire object graph.

    When you query the database through Linq, the GetById or GetAll methods, the repository deserialises the json back into the entities you saved with the full object graph intact.

     

    What will be supported in Version 1.0

    The features within V1.0 should cover the needs of most Windows 7 Phone applications, these features include:

    CRUD operations via:

    • Add
    • Update
    • Delete
    • GetById
    • GetAll
    • Query – Full Linq to Objects Support

    All Add, Update and Delete calls on the repository are actually saved as requests, this means that they are not actioned immediately. A call to RapidContext.Current.SaveChanges() is required to persist all of the changes.

    This feature will enable a number of useful possibilities including:

    • Multiple operations with one call to action – Unit of Work Pattern
    • Ability to examine all changes and alter or remove them before persisting.

     

    Caching

    By default, all entities persisted and queried from the repository are placed into a cache – this helps to keep the speed of the app as fast as possible.

     

    Eager Loading

    Eager loading entities into the cache is supported, this can be called at any point (normally at the start of the application).

    It loads all of the entities of the specified type into the cache, this is run as a background process so will not affect application usage.

    Providing the eager loading has completed, any queried entities will be brought out of the cache (very fast), if it ha not completed, they will be deserialised from the isolated storage as per default.

     

    No-Cache

    You can explicitly set certain entities not to cache if required, this means that the entities in question will always be deserialised from the corresponding files in isolated storage.

     

    Road Map

    At the moment I’ve been concentrating on the first initial release, I do however want to implement Transactional support and an index/view feature for even better querying.

     

    I hope people like using this api and it really helps when developing for the Windows 7 Phone.

     

    Kind Regards,

     

    Sean McAlinden

    1 Comment

    • While Windows 8 includes familiar programs like Control Panel
      and Task Manager, finding them in this new ecosystem has presented a challenge--even for those
      who've been around the block for the last 30 days. One of the major causes of the Windows 8 watchdog error is incompatible hardware. Pros: The basic approach to combining windows and portable devices is the right direction. That is the million dollar question if you are upgrading from Windows XP or Windows 7 to Windows 8. Unlike any other video content, premium video content requires two substantial platform features in order to deliver the best experience. Needless to say, Microsoft will be further upgrading its troubleshooting arsenal including knowledgebase, Microsoft Fix It, Windows Repair Options, Security Essentials, Disk Defragmenter, Disk Cleanup, and other tools besides inducting suave new repair utilities like Reset your PC and Refresh your PC to empower you to stay productive and safe.

    Comments have been disabled for this content.