Windows 7 Phone Database - RapidRepository
Hi All,
Just a quick note to let people know about a project I’ve started that hopefully will be really helpful for people about to start developing for the Windows 7 Phone.
The project called Rapid Repository is a essentially a document database that sites on top of the windows 7 phone isolated storage.
The repository is really simple to use (There is no setup, the following code example shows pretty much all you have to do to persist data).
You create a repository derived from the RapidRepository<> and you can do the usual Add, Update, Delete, GetAll and Query.
Once you have added, updated or deleted your entities, you simple call RapidContext.CurrentContext.SaveChanges() and all of your changes are persisted.
For example:
- ICustomerRepository repository = new CustomerRepository();
- Customer customer = new Customer();
- customer.Name = "Sean";
- customer.Address = new Address() { PostCode = "SW1 XXX" };
- customer.FavouriteUrls.Add("http://www.codeplex.com");
- repository.Add(customer);
- RapidContext.CurrentContext.SaveChanges();
You can also query the database using linq for example:
- var customers = repository.Query().where(x => x.Address.PostCode.Contains("SW1")).ToList();
Note: You will need to implement IRapidEntity on your root entity – this literally enforces a Guid id on the root entity.
I have a basic road map to add transactional support, implement a proper query solution including indexes/views etc.
The full source code and a test mobile app can be found at codeplex via the following: http://rapidrepository.codeplex.com/
Anyway, I would love to hear any thoughts and ideas for the project and I hope you find it useful.
Kind Regards,
Sean McAlinden.